Re: [BUGS] database introspection error

2011-04-23 Thread Tom Lane
"Kevin Grittner" writes: > Jon Nelson wrote: >> Would the following query be more (most?) correct, assuming the >> oid of the table is known? > It doesn't seem to work for indexes on expressions. Depends on what you mean by "work". If you're looking for attributes that are used as simple inde

Re: [BUGS] database introspection error

2011-04-22 Thread Kevin Grittner
Jon Nelson wrote: > Would the following query be more (most?) correct, assuming the > oid of the table is known? It doesn't seem to work for indexes on expressions. Try this: create table t (id int not null primary key, txt text); create index t_weird on t ((substring(txt, 1, id))); create

Re: [BUGS] database introspection error

2011-04-22 Thread Jon Nelson
On Thu, Apr 21, 2011 at 11:28 AM, Tom Lane wrote: > Jon Nelson writes: >> SQLAlchemy encountered an error introspecting the tables. After >> inspecting the SQL that it was running, I boiled it down to this: > >> SELECT c.relname,  a.attname >> FROM pg_index i, pg_class c, pg_attribute a >> WHERE

Re: [BUGS] database introspection error

2011-04-21 Thread Tom Lane
Jon Nelson writes: > SQLAlchemy encountered an error introspecting the tables. After > inspecting the SQL that it was running, I boiled it down to this: > SELECT c.relname, a.attname > FROM pg_index i, pg_class c, pg_attribute a > WHERE i.indrelid = '16684' AND i.indexrelid = c.oid > AND a.att

[BUGS] database introspection error

2011-04-21 Thread Jon Nelson
I'm using SQLAlchemy which has database introspection smarts. Basically, you point it at a database and tell it to find out what tables are there and introspect them, the table indices, etc... It works super. Until today. Yesterday, I restructured one of my tables (specifically, I dropped one col