Re: Is there a way to create a functional index that tables tableoidcolumn as an arg?
От | Ryan Murphy |
---|---|
Тема | Re: Is there a way to create a functional index that tables tableoidcolumn as an arg? |
Дата | |
Msg-id | CAHeEsBeCchYGrMbZ=f07jMPO6t=WZRY7dvQhgLCTBwOMB0KXXg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Is there a way to create a functional index that tables tableoidcolumn as an arg? (David Rowley <david.rowley@2ndquadrant.com>) |
Ответы |
Re: Is there a way to create a functional index that tables tableoid column as an arg?
|
Список | pgsql-general |
Hi David! Thanks for the reply.
> tableoid might be an exception to
> this, but it does not really seem like a useful column to index,
> giving it would be indexing the same value for each record in the
> table.
-- get all animals that are persons
select ... from animal where tableoid in (select
get_inherited_tables('person'::regclass);
-- get all animals that are not persons
select ... from animal where tableoid not in (select
get_inherited_tables('person'::regclass);
That's a great idea. I'll try it!
Just be careful around search_paths and your use of regclass. In this
case, if "animal" was not in the first schema in search_path, but
someone created another table called "person" that was in the first
schema listed in search_path, then the query would not do what you
want. You might want to consider prefixing the input parameter into
get_inherited_tables with the schema name too.
Good point.
Thanks again!
Ryan
В списке pgsql-general по дате отправления: