Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gO99E-0003Wu-UB for pgsql-bugs@arkaria.postgresql.org; Sat, 17 Nov 2018 22:33:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gO99B-0006rB-CJ for pgsql-bugs@arkaria.postgresql.org; Sat, 17 Nov 2018 22:33:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gO99B-0006r4-2X for pgsql-bugs@lists.postgresql.org; Sat, 17 Nov 2018 22:33:01 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gO993-0004iX-9F for pgsql-bugs@lists.postgresql.org; Sat, 17 Nov 2018 22:32:59 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id wAHMWmED007718; Sat, 17 Nov 2018 17:32:48 -0500 From: Tom Lane To: ertugrul9090@gmail.com cc: Peter Eisentraut , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15511: Drop table error "invalid argument" In-reply-to: <2510.1542487896@sss.pgh.pa.us> References: <15511-1d8b6a0bc874112f@postgresql.org> <2510.1542487896@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sat, 17 Nov 2018 15:51:36 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <7716.1542493968.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Sat, 17 Nov 2018 17:32:48 -0500 Message-ID: <7717.1542493968@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I wrote: > =?utf-8?q?PG_Bug_reporting_form?= writes: >> Drop table error "HATA: vsnprintf failed: Invalid argument", error >> code:"XX000" , PostgreSQL version..: "11.1" > Hmm. Looking at snprintf.c, EINVAL could only be returned for an > incorrect translated message (i.e. wrong use of %n$ notation), > so it seems somebody fat-fingered a translation. We can infer > that you're using the Turkish message set, but that doesn't help > much to narrow down where the mistake is. What do you see if you > do "set lc_messages = 'C'" and then repeat the failing command? I poked at that to the extent of testing every string in 11.1's tr.po against our implementation of snprintf, and what I find is this: #. translator: second %s is, e.g., "table %s" #: catalog/objectaddress.c:2694 #, c-format msgid "column %s of %s" msgstr "%2$s'nin %1$ sütunu" This msgstr is legal according to POSIX, so it's not surprising that GNU msgfmt doesn't complain about it; but our version of snprintf() does, because space is not a valid flag character according to it. So the bit "%1$ s" is valid to msgfmt but not to us. Presumably, what failed for you was something along the lines of regression=# create table foo (f1 int); CREATE TABLE regression=# create table bar (f1 foo); CREATE TABLE regression=# drop table foo; ERROR: cannot drop table foo because other objects depend on it DETAIL: column f1 of table bar depends on type foo HINT: Use DROP ... CASCADE to drop the dependent objects too. Conclusions: (1) I don't know Turkish, but it seems clear that this is a typo and the string ought to be msgstr "%2$s'nin %1$s sütunu" (2) It seems like a bad idea that pvsnprintf(), which must have reported this message, knows full well that it's dealing with a broken format string and yet doesn't print out that format string. It would have taken much less work to find this problem if it had. (3) I'm quite unwilling to try to make snprintf.c accept absolutely everything that's in the POSIX spec, especially seeing that this particular omission caught a mistake. (4) However, that leaves us with a translation problem, because msgfmt doesn't detect some things that we'll fail on at runtime. What shall we do about that? regards, tom lane