Patch: Extend NOT NULL representation to pg_constraint
От | José Arthur Benetasso Villanova |
---|---|
Тема | Patch: Extend NOT NULL representation to pg_constraint |
Дата | |
Msg-id | AANLkTimbjV+-Q+bpycRKRasEu2ThhYQig6e=LoqfTbAX@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Patch: Extend NOT NULL representation to
pg_constraint
|
Список | pgsql-hackers |
Hi all.<br /><br />My name is Jose Arthur and I use PostgreSQL for a while, but never contributed to the main project, untilnow.<br /><br />Since nobody else take this patch to review in this commitfest, I'm going to try :-). The main problemcan be found here: <a href="http://archives.postgresql.org/pgsql-hackers/2009-11/msg00146.php">http://archives.postgresql.org/pgsql-hackers/2009-11/msg00146.php</a><br clear="all"/><br />How to simulate:<br /><br />CREATE TABLE foo(id integer NOT NULL, val text NOT NULL);<br />CREATE TABLEfoo2(another_id integer NOT NULL) INHERITS(foo);<br />ALTER TABLE foo2 ALTER COLUMN val DROP NOT NULL;<br />insert intofoo2 values (1, null, 1);<br /><br />Then pg_dump > dump.pgsql and psql -f dump.pgsql<br /><br />I've applied thepatch submitted here: <a href="http://archives.postgresql.org/pgsql-hackers/2010-09/msg00763.php">http://archives.postgresql.org/pgsql-hackers/2010-09/msg00763.php</a> againstcurrent master (635de8365f0299cfa2db24c56abcfccb65d020f0) and compile is fine<br /><br />Using the patch, I can'tdrop NOT NULL from foo2, just from foo, and I think that makes sense:<br /><br />postgres=# ALTER TABLE foo2 ALTER COLUMNval DROP NOT NULL;<br />ERROR: cannot drop inherited NOT NULL constraint "foo2_val_not_null", relation "foo2"<br /><br/>One thing that I take notice is when you create a simple table like this one: select count(*) from pg_constraint ;12 rows appears in pg_constraint, 10 to the sequence. Is that ok?<br /><br />Other thing: <br />#define CONSTRAINT_NOTNULL 'n' in src/include/catalog/pg_constraint.h is using spaces instead of tabs :-)<br /><br /><br/>-- <br />José Arthur Benetasso Villanova<br />
В списке pgsql-hackers по дате отправления: