pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedfinding indexed functions from pg_index
3+ messages / 3 participants
[nested] [flat]
* finding indexed functions from pg_index
@ 2005-09-20 18:15 Scott Cain <cain@cshl.edu>
2005-09-20 21:54 ` Re: finding indexed functions from pg_index Tom Lane <tgl@sss.pgh.pa.us>
2005-09-20 22:03 ` Re: finding indexed functions from pg_index Michael Fuhr <mike@fuhr.org>
0 siblings, 2 replies; 3+ messages in thread
From: Scott Cain @ 2005-09-20 18:15 UTC (permalink / raw)
To: pgsql-interfaces
Hi,
I am trying to modify SQL::Translator, a perl module for translating
various dialects of SQL ddl (table, index creates, constraints, etc) (and
it does other cool things too, check it out!), to talk directly to a
PostgreSQL database to determine what tables it has, what columns they
have, indexes, constraints, etc. I have mostly figured out what I need
from pg_namespace, pg_class, pg_index and pg_attribute.
What I haven't figure out is this: how does one determine what the
declarative statement is for a functional index that is obtained from
pg_index.indexprs? What I would like to be able to do is be able to
recreate the SQL that defined that index. Is that represented somewhere
in another system table?
Thanks,
Scott
----------------------------------------------------------------------
Scott Cain, Ph. D. cain@cshl.org
GMOD Coordinator, http://www.gmod.org/ (216)392-3087
----------------------------------------------------------------------
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: finding indexed functions from pg_index
2005-09-20 18:15 finding indexed functions from pg_index Scott Cain <cain@cshl.edu>
@ 2005-09-20 21:54 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 3+ messages in thread
From: Tom Lane @ 2005-09-20 21:54 UTC (permalink / raw)
To: Scott Cain <cain@cshl.edu>; +Cc: pgsql-interfaces
Scott Cain <cain@cshl.edu> writes:
> What I haven't figure out is this: how does one determine what the
> declarative statement is for a functional index that is obtained from
> pg_index.indexprs? What I would like to be able to do is be able to
> recreate the SQL that defined that index. Is that represented somewhere
> in another system table?
Use pg_get_indexdef().
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: finding indexed functions from pg_index
2005-09-20 18:15 finding indexed functions from pg_index Scott Cain <cain@cshl.edu>
@ 2005-09-20 22:03 ` Michael Fuhr <mike@fuhr.org>
1 sibling, 0 replies; 3+ messages in thread
From: Michael Fuhr @ 2005-09-20 22:03 UTC (permalink / raw)
To: Scott Cain <cain@cshl.edu>; +Cc: pgsql-interfaces
On Tue, Sep 20, 2005 at 02:15:36PM -0400, Scott Cain wrote:
> What I haven't figure out is this: how does one determine what the
> declarative statement is for a functional index that is obtained from
> pg_index.indexprs? What I would like to be able to do is be able to
> recreate the SQL that defined that index.
See the pg_get_indexdef() function.
http://www.postgresql.org/docs/8.0/interactive/functions-info.html
When trying to figure out how to query the system catalogs, it can
be useful to study the queries that psql runs for \d commands. Run
"psql -E" or execute "\set ECHO_HIDDEN" to see those queries.
--
Michael Fuhr
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2005-09-20 22:03 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-09-20 18:15 finding indexed functions from pg_index Scott Cain <cain@cshl.edu>
2005-09-20 21:54 ` Tom Lane <tgl@sss.pgh.pa.us>
2005-09-20 22:03 ` Michael Fuhr <mike@fuhr.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox