From: Gavin Flower <gavin.flower@archidevsys.co.nz>
To: pgsql-bugs@postgresql.org
Subject: BUG #6095: Misleading error message: INSERT has more expressions than target columns
Date: Fri, 8 Jul 2011 00:29:08 GMT
Message-ID: <201107080029.p680T8dO058681@wwwmaster.postgresql.org> (raw)
The following bug has been logged online:
Bug reference: 6095
Logged by: Gavin Flower
Email address: gavin.flower@archidevsys.co.nz
PostgreSQL version: 9.1beta2
Operating system: x86_64 Linux
Description: Misleading error message: INSERT has more expressions
than target columns
Details:
Using pg 9.1beta2 compiled using gcc (GCC) 4.5.1 20100924 (Red Hat 4.5.1-4),
on a 64 bit Linux system.
In the 'INSERT INTO' construct: I think that psql should first check that
the fields listed after the table name are valid, before checking that the
number of columns specified is sufficient for the number of expressions.
Due to my poor eyesight: it took me a few minutes before I realized that I
had used a fullstop '.' rather than a comma ',' in the list of columns.
There is neither a schema, nor a database, called 'id' - so I would have
thought that pg should have been able to detect the error.
DROP TABLE wage;
CREATE TABLE wage
(
id int PRIMARY KEY,
pay numeric(5,2)
);
INSERT INTO wage (id. pay)
VALUES (1, 4.2);
TABLE wage;
//// output
$ psql < bug.sql
DROP TABLE
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "wage_pkey"
for table "wage"
CREATE TABLE
ERROR: INSERT has more expressions than target columns
LINE 2: VALUES (1, 4.2);
^
id | pay
----+-----
(0 rows)
$
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: gavin.flower@archidevsys.co.nz
Subject: Re: BUG #6095: Misleading error message: INSERT has more expressions than target columns
In-Reply-To: <201107080029.p680T8dO058681@wwwmaster.postgresql.org>
References: <201107080029.p680T8dO058681@wwwmaster.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox