Re: Re: starting to review the Extend NOT NULL representation to pg_constraint patch - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Re: starting to review the Extend NOT NULL representation to pg_constraint patch
Date
Msg-id 1308242572-sup-2178@alvh.no-ip.org
Whole thread Raw
In response to Re: Re: starting to review the Extend NOT NULL representation to pg_constraint patch  (Bernd Helmle <mailings@oopsware.de>)
Responses Re: Re: starting to review the Extend NOT NULL representation to pg_constraint patch
List pgsql-hackers

Thanks, I am looking at the new version from Bernd's git repo.  One
problem I noticed is that it doesn't really work correctly for all
callers of heap_create_with_catalog -- you're only passing the cooked
not null constraints in DefineRelation, but there are some other places
that call heap_create_with_catalog too.  In particular, bootstrap mode
is not handled; I haven't checked the other callers yet.  I'm looking
for the best way to handle that.

So, question: do we need pg_constraint rows to exist for all NOT NULL
constraints, including those in system catalogs, and including those in
bootstrap catalogs?  If we're going to require that, we're going to need
to add a few initial data lines to the pg_constraint catalog definition,
plus some code to handle the other bootstrap cases (non bootstrap
relations).

We could also declare that we don't need pg_constraint rows for NOT NULL
constraints in system catalogs; but if we're going to do that, I guess
we'd better disallow tables from inheriting system catalogs.  Right now
it's not disallowed but I guess it's pretty useless

alvherre=# create table bar() inherits (pg_class);
CREATE TABLE

... on the other hand, being able to use a catalog in a LIKE column
definition sounds like it could be useful:

alvherre=# create table qux (now timestamp, like pg_class);
CREATE TABLE
alvherre=# \d qux                     Tabla «public.qux»   Columna     |            Tipo             | Modificadores 
----------------+-----------------------------+---------------now            | timestamp without time zone | relname
   | name                        | not nullrelnamespace   | oid                         | not nullreltype        | oid
                      | not null
 


-- 
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: Florian Pflug
Date:
Subject: Re: proposal: a validator for configuration files
Next
From: Alvaro Herrera
Date:
Subject: Re: Patch - Debug builds without optimization