From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
---|---|
To: | Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: in-catalog Extension Scripts and Control parameters (templates?) |
Date: | 2013-07-01 16:55:47 |
Message-ID: | 20130701165547.GG3757@eldon.alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Davis | 2013-07-01 16:55:51 | Re: fallocate / posix_fallocate for new WAL file creation (etc...) |
Previous Message | Bruce Momjian | 2013-07-01 16:51:38 | Re: Optimizing pglz compressor |