Re: in-catalog Extension Scripts and Control parameters (templates?)

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: in-catalog Extension Scripts and Control parameters (templates?)
Дата
Msg-id 20130701165547.GG3757@eldon.alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: in-catalog Extension Scripts and Control parameters (templates?)  (Dimitri Fontaine <dimitri@2ndQuadrant.fr>)
Список pgsql-hackers
I think this is unlikely to work reliably:

+   PG_TRY();
+   {
+       ExtensionControl *control = read_extension_control_file(extname);
+ 
+       if (control)
+       {
+           ereport(ERROR,
+                   (errcode(ERRCODE_DUPLICATE_OBJECT),
+                    errmsg("extension \"%s\" is already available", extname)));
+       }
+   }
+   PG_CATCH();
+   {
+       /* no control file found is good news for us */
+   }
+   PG_END_TRY();

What if read_extension_control_file() fails because of an out-of-memory
error?  I think you need to extend that function to have a more useful
API, not rely on it raising a specific error.  There is at least one
more case when you're calling that function in the same way.

It'd probably work to have a boolean return (found/not found), and
return the ExtensionControl structure through a pointer.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



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

Предыдущее
От: Jeff Davis
Дата:
Сообщение: Re: fallocate / posix_fallocate for new WAL file creation (etc...)
Следующее
От: Atri Sharma
Дата:
Сообщение: Re: Randomisation for ensuring nlogn complexity in quicksort