Re: Proposal: variant of regclass
От | Pavel Stehule |
---|---|
Тема | Re: Proposal: variant of regclass |
Дата | |
Msg-id | CAFj8pRAMJ1b6vjxsp-76CjOtiKBxTPxuMW6gnMqCLcDCWg1K5Q@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Proposal: variant of regclass (Andres Freund <andres@2ndquadrant.com>) |
Ответы |
Re: Proposal: variant of regclass
|
Список | pgsql-hackers |
2013/12/5 Andres Freund <andres@2ndquadrant.com>
On 2013-12-04 20:25:53 -0500, Tom Lane wrote:
> Tatsuo Ishii <ishii@sraoss.co.jp> writes:
> > I would like to add a variant of regclass, which is exactly same as
> > current regclass except it does not raise an error when the target
> > table is not found. Instead it returns InvalidOid (0).
>
> I've sometimes thought we should just make all the reg* input converters
> act that way. It's not terribly consistent that they'll happily take
> numeric inputs that don't correspond to any existing OID. And more
> often than not, I've found the throw-an-error behavior to be annoying
> not helpful.
I find that to be a bit of a scary change. I have seen application check
for the existance of tables using the error thrown by ::regclass. Now,
they could change that to check for IS NULL which would be better for
them performancewise, but the likelihood they will notice in time seems
small.
this change can break some applications
but personally I like this change.
We can introduce some assert polymorphic function
CREATE OR REPLACE FUNCTION notnull(any, message text) RETURNS any, that can be used for check inside SQL
Regards
Pavel
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
В списке pgsql-hackers по дате отправления: