Re: [HACKERS] regclass without error?

2011-01-04 Thread Tom Lane
Tatsuo Ishii writes: >> Why is any of this necessary? It sure looks like you are solving a >> problem at the wrong level. > Please read upthread. You haven't made any argument why this shouldn't be solvable at the client side, or at worst with a plpgsql DO block; either of which answer would ha

Re: [HACKERS] regclass without error?

2011-01-04 Thread Tatsuo Ishii
> Why is any of this necessary? It sure looks like you are solving a > problem at the wrong level. Please read upthread. -- Tatsuo Ishii SRA OSS, Inc. Japan English: http://www.sraoss.co.jp/index_en.php Japanese: http://www.sraoss.co.jp -- Sent via pgsql-hackers mailing list (pgsql-hackers@post

Re: [HACKERS] regclass without error?

2011-01-04 Thread Tom Lane
Tatsuo Ishii writes: >> It's not generally safe to suppress errors like that. You could leak >> locks or tuple descriptors etc. And if the error is not "no scuh >> table", but e.g. out of memory, you don't want to suppress it anyway. > Thanks. I will create more "invasive" patch. Why is any of t

Re: [HACKERS] regclass without error?

2011-01-04 Thread Tatsuo Ishii
> It's not generally safe to suppress errors like that. You could leak > locks or tuple descriptors etc. And if the error is not "no scuh > table", but e.g. out of memory, you don't want to suppress it anyway. Thanks. I will create more "invasive" patch. -- Tatsuo Ishii SRA OSS, Inc. Japan English

Re: [HACKERS] regclass without error?

2011-01-04 Thread Heikki Linnakangas
On 04.01.2011 11:07, Tatsuo Ishii wrote: Datum pgpool_regclass(PG_FUNCTION_ARGS) { char*pro_name_or_oid = PG_GETARG_CSTRING(0); Oid result; PG_TRY(); { result = DirectFunctionCall1(regclassin,

Re: [HACKERS] regclass without error?

2011-01-04 Thread Tatsuo Ishii
Long time ago, I propose regclass like function which does not throw an error if the table is not found. Instead I want to let it return InvalidOid or NULL. >> Tatsuo Ishii writes: >> > Is there any way to use regclass without having ERROR? >> >> > pgpool-II needs to find the oid from table name

Re: [HACKERS] regclass without error?

2010-09-03 Thread Tatsuo Ishii
> Tatsuo Ishii writes: > > Is there any way to use regclass without having ERROR? > > > pgpool-II needs to find the oid from table name and for the purpose it > > issues something like "SELECT 'table_name'::regproc::oid". Problem is, > > if the table does not exist, an error occured and the trans

Re: [HACKERS] regclass without error?

2010-09-03 Thread Alvaro Herrera
Excerpts from David Fetter's message of vie sep 03 13:31:00 -0400 2010: > We have no mechanism to do this, or any other check, during a bulk > load. It'd be a great feature to have :) I'm not sure what kind of bulk load you are talking about, nor what does it have to do with pgpool-II. -- Álva

Re: [HACKERS] regclass without error?

2010-09-03 Thread David Fetter
On Fri, Sep 03, 2010 at 01:28:15PM -0400, Alvaro Herrera wrote: > Excerpts from David Fetter's message of vie sep 03 10:21:00 -0400 2010: > > > > How about using a SAVEPOINT before the cast? Wouldn't fail your > > > transaction.. > > > > For unattended operation, there are some issues: > > > >

Re: [HACKERS] regclass without error?

2010-09-03 Thread Alvaro Herrera
Excerpts from David Fetter's message of vie sep 03 10:21:00 -0400 2010: > > How about using a SAVEPOINT before the cast? Wouldn't fail your > > transaction.. > > For unattended operation, there are some issues: > > * Generating appropriate SAVEPOINT names > * Keeping track of same > * Detecting

Re: [HACKERS] regclass without error?

2010-09-03 Thread David E. Wheeler
On Sep 3, 2010, at 7:31 AM, Tom Lane wrote: > I don't think the cast should act that way, but I could see providing a > separate conversion function that returns 0 ... or perhaps better NULL > ... if no match. +1 I could use this in pgTAP. David -- Sent via pgsql-hackers mailing list (pgsql-ha

Re: [HACKERS] regclass without error?

2010-09-03 Thread Pavel Golub
Hello, guys. You wrote: TI> Hi, TI> Is there any way to use regclass without having ERROR? TI> pgpool-II needs to find the oid from table name and for the purpose it TI> issues something like "SELECT 'table_name'::regproc::oid". Problem is, TI> if the table does not exist, an error occured and

Re: [HACKERS] regclass without error?

2010-09-03 Thread Tom Lane
Tatsuo Ishii writes: > Is there any way to use regclass without having ERROR? > pgpool-II needs to find the oid from table name and for the purpose it > issues something like "SELECT 'table_name'::regproc::oid". Problem is, > if the table does not exist, an error occured and the transaction > abo

Re: [HACKERS] regclass without error?

2010-09-03 Thread David Fetter
On Fri, Sep 03, 2010 at 05:10:44PM +0300, Marko Tiikkaja wrote: > On 2010-09-03 4:46 PM, Tatsuo Ishii wrote: > >>You can write a query against the system catalog tables. > > > >That was pretty hard than I though(schema search path etc.). > > > >>Or you could > >>install a function that wraps the re

Re: [HACKERS] regclass without error?

2010-09-03 Thread Marko Tiikkaja
On 2010-09-03 4:46 PM, Tatsuo Ishii wrote: You can write a query against the system catalog tables. That was pretty hard than I though(schema search path etc.). Or you could install a function that wraps the regclass cast in an exception handler. That requires users to install the function.

Re: [HACKERS] regclass without error?

2010-09-03 Thread Tatsuo Ishii
> You can write a query against the system catalog tables. That was pretty hard than I though(schema search path etc.). > Or you could > install a function that wraps the regclass cast in an exception > handler. That requires users to install the function. Annoying for users. -- Tatsuo Ishii SRA

Re: [HACKERS] regclass without error?

2010-09-03 Thread Robert Haas
On Fri, Sep 3, 2010 at 4:28 AM, Tatsuo Ishii wrote: > Is there any way to use regclass without having ERROR? > > pgpool-II needs to find the oid from table name and for the purpose it > issues something like "SELECT 'table_name'::regproc::oid". Problem is, > if the table does not exist, an error o

[HACKERS] regclass without error?

2010-09-03 Thread Tatsuo Ishii
Hi, Is there any way to use regclass without having ERROR? pgpool-II needs to find the oid from table name and for the purpose it issues something like "SELECT 'table_name'::regproc::oid". Problem is, if the table does not exist, an error occured and the transaction aborts. Ideally if the table d