Prepared statements fail after schema changes with surprising error

Поиск
Список
Период
Сортировка
От Peter van Hardenberg
Тема Prepared statements fail after schema changes with surprising error
Дата
Msg-id CAAcg=kXvWLuYQmWLHj6mUQf_CHEx9UgAdjSEd4e+_qX09OPxxg@mail.gmail.com
обсуждение исходный текст
Ответы Re: Prepared statements fail after schema changes with surprising error  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Prepared statements fail after schema changes with surprising error  ("Dickson S. Guedes" <listas@guedesoft.net>)
Список pgsql-hackers
A user reported an interesting issue today. After restoring a dump created with --clean on a running application in his development environment his application started complaining of missing tables despite those tables very clearly existing.

After a little thinking, we determined that this was due to the now-default behaviour of Rails to create prepared statements for most queries. The prepared statements error out because the old relation they point to is missing, but this gives a misleading report thus:

PG::Error: ERROR: relation "xxx" does not exist

I'm not sure what the best outcome here would be. A very simple solution might be to expand the error message or add a hint to make it descriptive enough that a user might be able to figure out the cause on their own without happening to have the unusual intersection of Rails and Postgres internals knowlege I (unfortunately) possess. A better solution might be to attempt to re-prepare the statement before throwing an error.

-pvh

--
Peter van Hardenberg
San Francisco, California
"Everything was beautiful, and nothing hurt." -- Kurt Vonnegut

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Request for vote to move forward with recovery.conf overhaul
Следующее
От: "Dickson S. Guedes"
Дата:
Сообщение: Re: Event Triggers: adding information