Re: a modest improvement to get_object_address()

Поиск
Список
Период
Сортировка
От Cédric Villemain
Тема Re: a modest improvement to get_object_address()
Дата
Msg-id CAF6yO=2UXe5oeWp3nVtXvzuZHnEvFeB-vY0qo-kC5ni=5dhb5g@mail.gmail.com
обсуждение исходный текст
Ответ на a modest improvement to get_object_address()  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: a modest improvement to get_object_address()  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
2011/11/9 Robert Haas <robertmhaas@gmail.com>:
> I'd like to propose the attached patch, which changes
> get_object_address() in a manner similar to what we did in
> RangeVarGetRelid() in commit 4240e429d0c2d889d0cda23c618f94e12c13ade7.
>  The basic idea is that, if we look up an object name, acquire the
> corresponding lock, and then find that the object was dropped during
> the lock wait, we retry the whole operation instead of emitting a
> baffling error message.  Example:
>
> rhaas=# create schema x;
> CREATE SCHEMA
> rhaas=# begin;
> BEGIN
> rhaas=# drop schema x;
> DROP SCHEMA
>
> Then, in another session:
>
> rhaas=# comment on schema x is 'doodle';
>
> Then, in the first session:
>
> rhaas=# commit;
> COMMIT
>
> At this point, the first session must error out.  The current code
> produces this:
>
> ERROR:  cache lookup failed for class 2615 object 16386 subobj 0
>
> With the attached patch, you instead get:
>
> ERROR:  schema "x" does not exist
>
> ...which is obviously quite a bit nicer.
>
> Also, if the concurrent transaction drops and creates the schema
> instead of just dropping it, the new code will allow the operation to
> succeed (with the expected results) rather than failing.
>
> Objections?

Maybe I miss something but:
The ERROR message is misleading:  the schema 'x' does exist. And also
why a drop schema would fail and a drop+create would success ?!


>
> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
>



--
Cédric Villemain +33 (0)6 20 30 22 52
http://2ndQuadrant.fr/
PostgreSQL: Support 24x7 - Développement, Expertise et Formation


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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: [COMMITTERS] pgsql: In COPY, insert tuples to the heap in batches.
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: Materialized views