Lists: | pgsql-hackers |
---|
From: | Rajeev rastogi <rajeev(dot)rastogi(at)huawei(dot)com> |
---|---|
To: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Observed an issue in CREATE TABLE syntax |
Date: | 2014-04-04 10:36:17 |
Message-ID: | BF2827DCCE55594C8D7A8F7FFD3AB7713DDDEBC5@SZXEML508-MBX.china.huawei.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
I observed an issue that even if invalid syntax is provided for CREATE TABLE, table is getting created successfully.
Below table creation succeed even though same constraint name is given multiple times.
None of the below constraints has any meaning of giving multiple times.
postgres=# create table new (id int NULL NULL);
CREATE TABLE
postgres=# create table new1(id serial NOT NULL NOT NULL);
CREATE TABLE
postgres=# create table new2 (id int unique unique);
CREATE TABLE
Should we not throw error for above syntaxes?
Please find the attached patch with the fix.
Thanks and Regards,
Kumar Rajeev Rastogi
Attachment | Content-Type | Size |
---|---|---|
multiconstissuev1.patch | application/octet-stream | 3.6 KB |
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Rajeev rastogi <rajeev(dot)rastogi(at)huawei(dot)com> |
Cc: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Observed an issue in CREATE TABLE syntax |
Date: | 2014-04-04 14:39:35 |
Message-ID: | 6551.1396622375@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Rajeev rastogi <rajeev(dot)rastogi(at)huawei(dot)com> writes:
> Should we not throw error for above syntaxes?
No. There's nothing wrong with those statements, and complaining about
them will accomplish nothing except to break applications that used to
work. Admittedly, code that generates such declarations would be a bit
sloppy, but people won't thank us for breaking it.
regards, tom lane