Re: Constraint stuff

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Constraint stuff
Дата
Msg-id 6517.965665968@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Constraint stuff  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Ответы Re: Constraint stuff  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-hackers
Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> Tom had suggested storing a more 
> understandable form of the foreign key constraint
> to make dumping more reasonable in its own table.
> I'd guess like the src stored for check constraints.

I wasn't actually thinking of storing source, but rather precompiled
expressions (as I remarked awhile ago, I think pg_relcheck's rcsrc
column is dead weight; we could and should generate the value on demand
by reverse-listing rcbin instead).  This gets you away from
rename-induced problems since everything is table OIDs, attribute column
numbers, operator and function OIDs, etc.

However, digging those references out of the expression tree is a little
bit painful; you're right that we shouldn't expect applications to do
that for themselves.  We could store an additional list of referenced
items.  We wouldn't necessarily have to store that explicitly either,
though --- functions to say "is this OID referenced in this stored
expression" or perhaps "give me an array of all function OIDs in this
expression" would get the job done AFAICS.

> One of the problems I see is that if taken to its end,
> would you store function oids here?  If so, that might
> make it harder to allow a drop function/create function
> to ever work transparently in the future.

I don't think we should worry about that.  What's actually needed IMHO
is an "ALTER FUNCTION" command that allows you to replace the body of
an existing function, and perhaps change its name, but NOT its type
signature (result type and number/types of arguments).  Changing the
signature is inherently not a transparent operation because it'd
invalidate stored expressions that use the function.  ALTER would let
you make safe changes to a function without changing its OID and thus
without invalidating references-by-OID.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Philip Warner
Дата:
Сообщение: Re: Re: [GENERAL] Trouble with float4 afterupgrading from 6.5.3 to 7.0.2
Следующее
От: Tom Lane
Дата:
Сообщение: Re: LIKE pattern matching