Re: See the WHERE clause of a partial index

Поиск
Список
Период
Сортировка
От Paul Jungwirth
Тема Re: See the WHERE clause of a partial index
Дата
Msg-id CA+6hpamoeQ0Xjo3eUx2eiNjtC55HtAh939n6yDs2FDithjNsqg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: See the WHERE clause of a partial index  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: See the WHERE clause of a partial index  (Paul Jungwirth <pj@illuminatedcomputing.com>)
Re: See the WHERE clause of a partial index  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
> pg_get_indexdef() should help.  If you really want just the WHERE
> clause, possibly pg_get_expr() would work, but I've not tried it on
> index clauses.

Thank you for such a quick response!

pg_get_indexdef is very helpful:

    > select pg_get_indexdef(223630);

pg_get_indexdef

-----------------------------------------------------------------------------------------------------------------------------------------------------
     CREATE UNIQUE INDEX
index_user_languages_on_user_id_and_language_id ON user_languages
USING btree (user_id, language_id) WHERE (deleted_at IS NULL)
    (1 row)

It'd be great to get just the WHERE clause if possible, although I can
work around it if not. I couldn't find much documentation re
pg_get_expr. Does this message mean I can't use it, or am I just doing
something wrong?:

    > select pg_get_expr('{NULLTEST :arg {VAR :varno 1 :varattno 6
:vartype 1114 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1
:varoattno 6 :location 128} :nulltesttype 0 :argisrow false}',
223630);
    ERROR:  cannot accept a value of type pg_node_tree
    LINE 1: select pg_get_expr('{NULLTEST :arg {VAR :varno 1 :varattno 6...

Thank you for your help!
Paul


--
_________________________________
Pulchritudo splendor veritatis.


В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: How to access the extension's operator installed with schema ?
Следующее
От: Sébastien Lorion
Дата:
Сообщение: Re: Amazon High I/O instances