Query to generate CREATE INDEX statement from

Поиск
Список
Период
Сортировка
Искать

Query to generate CREATE INDEX statement from

От:
Andrew Hammond <andrew.george.hammond@gmail.com>
Дата:
I'm building some partitioning support functions. I'm working on writing one called clone_indexes_to_partition right now. The idea is to take all the indexes applied to the parent and create a matching index on the child. Is there existing code that generates a CREATE INDEX statement given an indexrelid? 

Andrew

Re: Query to generate CREATE INDEX statement from

От:
Cédric Villemain <cedric.villemain.debian@gmail.com>
Дата:
2011/3/24 Andrew Hammond :
> I'm building some partitioning support functions. I'm working on writing one
> called clone_indexes_to_partition right now. The idea is to take all the
> indexes applied to the parent and create a matching index on the child. Is
> there existing code that generates a CREATE INDEX statement given
> an indexrelid?

Yes it is :
http://www.postgresql.org/docs/9.0/static/functions-info.html
pg_get_indexdef(index_oid) 	get CREATE INDEX command for index

> Andrew



-- 
Cédric Villemain               2ndQuadrant
http://2ndQuadrant.fr/     PostgreSQL : Expertise, Formation et Support

Re: Query to generate CREATE INDEX statement from

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Andrew Hammond  writes:
> I'm building some partitioning support functions. I'm working on writing one
> called clone_indexes_to_partition right now. The idea is to take all the
> indexes applied to the parent and create a matching index on the child. Is
> there existing code that generates a CREATE INDEX statement given an
> indexrelid?

pg_get_indexdef
		regards, tom lane

FAQ