Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id E03C319713C6 for ; Tue, 6 Dec 2011 12:38:10 -0400 (AST) Received: from gwmta.wicourts.gov ([165.219.244.99] helo=gw.wicourts.gov) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RXy1u-0008Vm-S3 for pgsql-bugs@postgresql.org; Tue, 06 Dec 2011 16:38:10 +0000 Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Tue, 06 Dec 2011 10:37:54 -0600 Message-Id: <4EDDF0790200002500043909@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Tue, 06 Dec 2011 10:37:45 -0600 From: "Kevin Grittner" To: , Subject: Re: BUG #6328: Wrong error message for insert-sql References: In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Pg-Spam-Score: -5.4 (-----) X-Archive-Number: 201112/51 X-Sequence-Number: 31862 wrote: =20 > INSERT INTO auftragpos (orderno,position,item) VALUES > (testorder18,1,00123); > brings error: > FEHLER: Spalte *testorder18* existiert nicht (Column > *testorder18* not exists) > LINE 1: ...T INTO auftragpos (orderno,position,item) VALUES > (testorder1... >=20 > But *testorder18* is a value, not a column-name=21?=21? > If there is a problem it should bring a message that the value for > column =22orderno=22 has the wrong format. =20 =27testorder18=27 is a literal value. Without the apostrophe quoting it is taken as an identifier, such as a column. It is entirely correct and appropriate for an error to be generated. The wording of the message could perhaps be adjusted to help the user understand their mistake more easily, since there are no columns in context from any table here; but the message is not actually wrong. Certain reserved words (such as CURRENT_DATE) would be allowed here, as would expressions of arbitrary complexity -- sub-selects, CASE predicates, functions, etc.; it would take a bit of work to sort out when something might be a malformed attempt at a literal versus a misspelled column name in a subquery. =20 -Kevin