Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fB42eOm41439 for ; Mon, 3 Dec 2001 21:40:24 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id fB42eKi21445; Mon, 3 Dec 2001 21:40:21 -0500 (EST) To: "Christopher Kings-Lynne" cc: "Ligia Pimentel" , "Hackers" Subject: Re: [SQL] An easy question about creating a primary key In-reply-to: <21379.1007432989@sss.pgh.pa.us> References: <21379.1007432989@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Mon, 03 Dec 2001 21:29:49 -0500" Date: Mon, 03 Dec 2001 21:40:20 -0500 Message-ID: <21442.1007433620@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200112/72 X-Sequence-Number: 16220 Now that I look at it, I think I made the relevant changes in the parser: 2001-10-11 20:07 tgl * doc/src/sgml/ref/alter_table.sgml, src/backend/catalog/pg_type.c, src/backend/commands/command.c, src/backend/parser/analyze.c, src/backend/tcop/utility.c, src/include/commands/command.h, src/include/nodes/parsenodes.h, src/test/regress/expected/alter_table.out, src/test/regress/expected/foreign_key.out: Break transformCreateStmt() into multiple routines and make transformAlterStmt() use these routines, instead of having lots of duplicate (not to mention should-have-been-duplicate) code. Adding a column with a CHECK constraint actually works now, and the tests to reject unsupported DEFAULT and NOT NULL clauses actually fire now. ALTER TABLE ADD PRIMARY KEY works, modulo having to have created the column(s) NOT NULL already. I was mainly interested in eliminating the inconsistencies in parse-time handling of CREATE TABLE and ALTER TABLE, and the ensuing bugs mentioned in the commit log. I didn't think much about the possibility that I was obsoleting stuff in command.c, but maybe I did. regards, tom lane