Search Postgresql Archives

Re: Feature Proposal: Constant Values in Columns or Foreign Keys

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Tom Lane wrote:

> =?UTF-8?Q?Nils_G=C3=B6sche?= <cartan@xxxxxxxxx> writes:

> > I was quite surprised to find that this wasn't possible. Is there any
> > good reason why not?
> 
> It's contrary to SQL standard is why not.  And it's not just a matter
> of
> being outside the spec, as inheritance is; this is messing with the
> details of something that is defined in the standard.  As an example,
> I would wonder how such an FK is supposed to be represented in the
> spec-defined information schema views.  Other interesting questions
> include what would happen to the supposed constant during actions such
> as ON DELETE SET NULL or ON UPDATE CASCADE, which normally would result
> in a change in the referencing row.

Well, something I can have already is a column together with a NOT NULL constraint, and a CHECK constraint that ensures that the value is really constant, and a foreign key that includes this constant column. You could just handle it the same way.

The information schema is a good point, though. If the only way to put this into the information schema is to introduce some dummy column, possibly with NULL as a name or something, then I don't like the idea much myself anymore.

I guess the best I could hope for, then, is an optimization that does not store constant columns on disk ;-)

Regards,
-- 
Nils Gösche
"Don't ask for whom the <CTRL-G> tolls."



-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Programming PHP]     [Kernel Newbies]     [PHP Classes]     [Find Someone Nice]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

Add to Google Powered by Linux