Re: Proposal: variant of regclass

From: Pavel Golub <pavel(at)microolap(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal: variant of regclass
Date: 2013-12-05 12:30:57
Message-ID: 486890200.20131205143057@gf.microolap.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello, Andres.

You wrote:

AF> On 2013-12-04 20:25:53 -0500, Tom Lane wrote:
>> Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)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.

AF> I find that to be a bit of a scary change. I have seen application check
AF> for the existance of tables using the error thrown by ::regclass. Now,
AF> they could change that to check for IS NULL which would be better for
AF> them performancewise, but the likelihood they will notice in time seems
AF> small.

I personally see two approaches:
1. Implement GUC variable controling this behaviour per session
2. Introduce new safe reg* variables, e.g. "sregclass", "sregtype" etc.

AF> Greetings,

AF> Andres Freund

AF> --
AF> Andres Freund http://www.2ndQuadrant.com/
AF> PostgreSQL Development, 24x7 Support, Training & Services

--
With best wishes,
Pavel mailto:pavel(at)gf(dot)microolap(dot)com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2013-12-05 12:42:21 Re: tracking commit timestamps
Previous Message Andres Freund 2013-12-05 12:20:47 Re: Performance optimization of btree binary search