[HACKERS] Possible bug in pg_settings/pg_depend

2011-01-13 Thread Joel Jacobson
Are multiple identical entires in pg_depend possible?
If so, how do they occur, and what is the purpose of representing
exactly the same dependency two times in pg_depend?

I expected the following query not to return any rows, but it did:

glue=# select count(*), * from pg_depend group by classid, objid,
objsubid, refclassid, refobjid, refobjsubid, deptype having count(*) 
1;
 count | classid | objid | objsubid | refclassid | refobjid |
refobjsubid | deptype
---+-+---+--++--+-+-
 2 |2618 | 11015 |0 |   1259 |11012 |   1 | n
(1 row)


Debug data:


glue=# select version();
   version
-
 PostgreSQL 9.1alpha3 on x86_64-unknown-linux-gnu, compiled by GCC gcc
(Ubuntu 4.4.3-4ubuntu5) 4.4.3, 64-bit
(1 row)

glue=# select pg_describe_object(2618,11015,0);
pg_describe_object

 rule pg_settings_u on view pg_settings
(1 row)

glue=# select pg_describe_object(1259,11012,1);  pg_describe_object
--
 view pg_settings column name
(1 row)



-- 
Best regards,

Joel Jacobson
Glue Finance

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Possible bug in pg_settings/pg_depend

2011-01-13 Thread Tom Lane
Joel Jacobson j...@gluefinance.com writes:
 Are multiple identical entires in pg_depend possible?

Yes, probably.  It's certainly possible to have the same linkage occur
with different deptypes.  We don't try hard to avoid dups because they
don't matter.

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Possible bug in pg_settings/pg_depend

2011-01-13 Thread Joel Jacobson
2011/1/13 Tom Lane t...@sss.pgh.pa.us:
 Yes, probably.  It's certainly possible to have the same linkage occur
 with different deptypes.  We don't try hard to avoid dups because they
 don't matter.

with different deptypes, yes, but in this case there were two
linkages of the same deptype.

Just seems a bit strange I only found one such in the entire database,
smells like some kind of bug, but might not be, I dunno, just thought
it was worth investigating a bit, but if you're sure about it I of
course trust you.

-- 
Best regards,

Joel Jacobson
Glue Finance

E: j...@gluefinance.com
T: +46 70 360 38 01

Postal address:
Glue Finance AB
Box  549
114 11  Stockholm
Sweden

Visiting address:
Glue Finance AB
Birger Jarlsgatan 14
114 34 Stockholm
Sweden

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Possible bug in pg_settings/pg_depend

2011-01-13 Thread Robert Haas
On Thu, Jan 13, 2011 at 2:04 PM, Joel Jacobson j...@gluefinance.com wrote:
 2011/1/13 Tom Lane t...@sss.pgh.pa.us:
 Yes, probably.  It's certainly possible to have the same linkage occur
 with different deptypes.  We don't try hard to avoid dups because they
 don't matter.

 with different deptypes, yes, but in this case there were two
 linkages of the same deptype.

 Just seems a bit strange I only found one such in the entire database,
 smells like some kind of bug, but might not be, I dunno, just thought
 it was worth investigating a bit, but if you're sure about it I of
 course trust you.

Instead of trusting him, you could investigate why it happens.  A
quick test shows this eliminates both dependencies:

drop rule pg_settings_u on pg_settings;

It appears that both of the dependencies in question are from that
rule and pointing to pg_settings.name, and it looks like that rule
mentions the name column of pg_settings twice.  With a little further
experimentation you can probably tease out whether each of the two
mentions produced a separate dependency...  my guess is yes.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers