Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id C451C1337BE0 for ; Sat, 23 Apr 2011 16:54:59 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 89980-03-5 for ; Sat, 23 Apr 2011 19:54:42 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 58C5F1337C26 for ; Sat, 23 Apr 2011 16:53:50 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p3NJrnxk004474; Sat, 23 Apr 2011 15:53:49 -0400 (EDT) To: "Kevin Grittner" cc: "Jon Nelson" , pgsql-bugs@postgresql.org Subject: Re: database introspection error In-reply-to: <4DB17239020000250003CBF2@gw.wicourts.gov> References: <24590.1303403331@sss.pgh.pa.us> <4DB17239020000250003CBF2@gw.wicourts.gov> Comments: In-reply-to "Kevin Grittner" message dated "Fri, 22 Apr 2011 12:19:05 -0500" Date: Sat, 23 Apr 2011 15:53:48 -0400 Message-ID: <4473.1303588428@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201104/184 X-Sequence-Number: 30103 "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 index columns, it's probably fine. If you want to also find attributes that are used in index expressions, you might want to make use of a join through pg_depend. One disadvantage of pg_depend is that it doesn't help for system catalog indexes (because indexes built at bootstrap time aren't included in pg_depend) --- not sure if that is something SQLAlchemy cares about. regards, tom lane