Re: [HACKERS] obj_description problems?

Lists: pgsql-hackerspgsql-patches
From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: obj_description problems?
Date: 2003-10-21 05:20:57
Message-ID: 3F94C239.3070601@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

How do I use a schema-qualified name in obj_description? Or is this a
nsty little bug?

Chris

test2=# create schema myschema;
CREATE SCHEMA
test2=# create table myschema.pg_class (a int4);
CREATE TABLE
test2=# select oid from pg_catalog.pg_class where
oid='myschema.pg_class'::regclass;
oid
---------
1475161
(1 row)

test2=# select obj_description('1475161', 'pg_class');
obj_description
-----------------

(1 row)

test2=# select obj_description('1475161', 'pg_catalog.pg_class');
obj_description
-----------------

(1 row)

test2=# set search_path to myschema, pg_catalog;
SET
test2=# select obj_description('1475161', 'pg_class');
ERROR: Attribute "relname" not found
test2=# select obj_description('1475161', 'pg_catalog.pg_class');
ERROR: Attribute "relname" not found


From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: obj_description problems?
Date: 2003-10-21 05:42:16
Message-ID: 3F94C738.8000804@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Ooer - it is a nasty bug. From pg_proc.h, the definition of
obj_description is:

select description from pg_description where objoid = $1 and classoid =
(select oid from pg_class where relname = $2 and relnamespace = PGNSP)
and objsubid = 0

And what's more, none of the SQL functions in pg_proc.h are properly
qualified. I have attached a patch that may or may not be the solution
- please check.

I didn't know how to handle 'timestamp without time zone' types and
'overlaps'.

I realise now that there's no need to schema-qualify names - you can
only do names from pg_catalog.

Chris

Christopher Kings-Lynne wrote:

> How do I use a schema-qualified name in obj_description? Or is this a
> nsty little bug?
>
> Chris
>
> test2=# create schema myschema;
> CREATE SCHEMA
> test2=# create table myschema.pg_class (a int4);
> CREATE TABLE
> test2=# select oid from pg_catalog.pg_class where
> oid='myschema.pg_class'::regclass;
> oid
> ---------
> 1475161
> (1 row)
>
> test2=# select obj_description('1475161', 'pg_class');
> obj_description
> -----------------
>
> (1 row)
>
> test2=# select obj_description('1475161', 'pg_catalog.pg_class');
> obj_description
> -----------------
>
> (1 row)
>
> test2=# set search_path to myschema, pg_catalog;
> SET
> test2=# select obj_description('1475161', 'pg_class');
> ERROR: Attribute "relname" not found
> test2=# select obj_description('1475161', 'pg_catalog.pg_class');
> ERROR: Attribute "relname" not found
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

Attachment Content-Type Size
pg_proc.txt text/plain 17.8 KB

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] obj_description problems?
Date: 2003-10-21 05:51:28
Message-ID: 3F94C960.9060603@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

*sigh* - it's really not my day today. Attached is patch that actually
compiles and fixes the problem. We will need to bump CATVERSION, and
maybe should test all the other qualified functions?

Chris

Attachment Content-Type Size
pg_proc2.txt text/plain 17.8 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] obj_description problems?
Date: 2003-10-21 14:13:00
Message-ID: 21903.1066745580@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> writes:
> *sigh* - it's really not my day today. Attached is patch that actually
> compiles and fixes the problem. We will need to bump CATVERSION, and
> maybe should test all the other qualified functions?

I think you've identified a real issue, but how many of these modified
functions did you actually test? I thought SUBSTRING was a reserved
word, for example ...

regards, tom lane


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] obj_description problems?
Date: 2003-10-21 16:27:45
Message-ID: 4103.1066753665@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> writes:
> *sigh* - it's really not my day today. Attached is patch that actually
> compiles and fixes the problem. We will need to bump CATVERSION, and

Reviewed, tested, applied.

> maybe should test all the other qualified functions?

What other qualified functions? There might possibly be some issues in
contrib stuff, but there are no other SQL-language functions defined in
the main system (except information_schema, which we already checked).

regards, tom lane


From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] obj_description problems?
Date: 2003-10-22 01:27:39
Message-ID: 3F95DD0B.5080603@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


>>*sigh* - it's really not my day today. Attached is patch that actually
>>compiles and fixes the problem. We will need to bump CATVERSION, and
>>maybe should test all the other qualified functions?
>
> I think you've identified a real issue, but how many of these modified
> functions did you actually test? I thought SUBSTRING was a reserved
> word, for example ...

Well, some... I did run the regression tests and they passed, but I
assumed that they would call all of the functions.

OK, I will test them all today and get back to you.

Chris


From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] obj_description problems?
Date: 2003-10-22 01:34:51
Message-ID: 3F95DEBB.6070502@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


> Reviewed, tested, applied.

Thanks.

>>maybe should test all the other qualified functions?
>
>
> What other qualified functions? There might possibly be some issues in
> contrib stuff, but there are no other SQL-language functions defined in
> the main system (except information_schema, which we already checked).

Sorry - I meant "other functions that are now properly qualified in my
patch". ie, you have already tested them.

Chris


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] obj_description problems?
Date: 2003-10-22 02:49:47
Message-ID: 7883.1066790987@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> writes:
> OK, I will test them all today and get back to you.

I checked them all before applying, but please do cross-check. We're
close enough to release that double- and triple-checking patches is
called for.

regards, tom lane


From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] obj_description problems?
Date: 2003-10-22 07:39:11
Message-ID: 3F96341F.5090602@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

> I checked them all before applying, but please do cross-check. We're
> close enough to release that double- and triple-checking patches is
> called for.

Checked them a bit - nothing too exhaustive.

Chris