Search Postgresql Archives

Re: Check for existence of index

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David Rysdam <drysdam@xxxxxxxxxx> writes:
> Why can't I have the same index name be on 
> different tables?

You can ... if they are in different schemas.  Indexes and tables share
the same namespace, ie, they must be unique within a schema.

As for your original question, you probably want something like

SELECT ... FROM pg_class c, pg_namespace n WHERE c.relnamespace = n.oid
  AND relname = 'indexname' AND nspname = 'schemaname' AND relkind = 'i';

If you actually want to verify that this index is on a specific table,
you'll need a more complicated join involving pg_index and a second
scan of pg_class.  See
http://www.postgresql.org/docs/8.0/static/catalogs.html

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux