Index expressions: how to recreate
От | Andreas Pflug |
---|---|
Тема | Index expressions: how to recreate |
Дата | |
Msg-id | 3F0179D5.7080804@pse-consulting.de обсуждение исходный текст |
Ответы |
Re: Index expressions: how to recreate
|
Список | pgsql-hackers |
I noticed the new expression functionality of indices and while implementing them in pgadmin3 was wonderingnow to extract the definition from the catalog. Consider an index that looks like this: CREATE INDEX foo ON bar (numcol, length(txtcol), intcol2, length(txtcol2)) Looking at pg_index: indkey will contain 1 0 4 indclass contains 1988 1978 1978 1978 (numeric, int, int, int) pg_get_expr(indexprs, indrelid)will deliver (length((txtcol)::text) AND (length(((txtcol2)::text))) indclass contains what I'd expect, but indkey shows only 3 columns and/or expressions. So I'd recreate the index as being defined as CREATE INDEX foo ON bar (numcol, (length(txtcol) AND length(txtcol2)), intcol2) which obviously isn't correct (and wouldn't execute either, AND with int operands) Why is indexprs not a text array containing "", "length(txtcol)", "", "length(txtcol2)" ? Regards, Andreas
В списке pgsql-hackers по дате отправления: