Re: Odd PL/PgSQL Error -- relation "X" does not exist when using index expression

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Odd PL/PgSQL Error -- relation "X" does not exist when using index expression
Дата
Msg-id 8064.1170948745@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Odd PL/PgSQL Error -- relation "X" does not exist when using index expression  (Michael Fuhr <mike@fuhr.org>)
Ответы Re: Odd PL/PgSQL Error -- relation "X" does not exist when using index expression  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-sql
Michael Fuhr <mike@fuhr.org> writes:
> Using separate calls to SPI_exec() works.  Using a single call to
> SPI_exec() works if the index is on (t) instead of (lower(t)):

> SPI_exec("CREATE TABLE foo (t text); CREATE INDEX foo_idx ON foo (t)", 0);

It's only by chance that it works in that case: the current coding of
transformIndexStmt happens not to try to touch the underlying table
if there aren't any expressions to analyze.  You can make a large number
of variants that will fail, eg, create the table and try to insert into
it in one command string.

My advice is not to try to execute multiple commands in the same EXECUTE
string --- if we were going to do anything to "fix" this, I think it
would be along the lines of enforcing that advice.  Trying to make the
world safe for it doesn't sound productive.
        regards, tom lane


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

Предыдущее
От: Adrien Lebre
Дата:
Сообщение: unsubscribe
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: Odd PL/PgSQL Error -- relation "X" does not exist when using index expression