Minor patch for the uuid-ossp extension

Started by Nonameabout 12 years ago8 messages
#1Noname
roadrunner6@gmx.at
1 attachment(s)

When trying to add the extension with \i it writes an error message:
Use "CREATE EXTENSION uuid-ossp" to load this file.

Unfortunatly this does not work for extensions with dashes. Must CREATE
EXTENSION "uuid-ossp". Proposed patch is attached.

Regards
Mario

Attachments:

uuid-ossp-patch.txttext/plain; charset=windows-1252; name=uuid-ossp-patch.txtDownload
diff -Nurb contrib.orig/uuid-ossp/uuid-ossp--1.0.sql contrib/uuid-ossp/uuid-ossp--1.0.sql
--- contrib.orig/uuid-ossp/uuid-ossp--1.0.sql   2013-11-22 13:48:21.588674030 +0100
+++ contrib/uuid-ossp/uuid-ossp--1.0.sql        2013-11-22 13:52:13.232387782 +0100
@@ -1,7 +1,7 @@
 /* contrib/uuid-ossp/uuid-ossp--1.0.sql */

 -- complain if script is sourced in psql, rather than via CREATE EXTENSION
-\echo Use "CREATE EXTENSION uuid-ossp" to load this file. \quit
+\echo Use CREATE EXTENSION "uuid-ossp" to load this file. \quit

 CREATE FUNCTION uuid_nil()
 RETURNS uuid
diff -Nurb contrib.orig/uuid-ossp/uuid-ossp--unpackaged--1.0.sql contrib/uuid-ossp/uuid-ossp--unpackaged--1.0.sql
--- contrib.orig/uuid-ossp/uuid-ossp--unpackaged--1.0.sql       2013-11-22 13:44:04.589862871 +0100
+++ contrib/uuid-ossp/uuid-ossp--unpackaged--1.0.sql    2013-11-22 13:52:19.480164238 +0100
@@ -1,7 +1,7 @@
 /* contrib/uuid-ossp/uuid-ossp--unpackaged--1.0.sql */

 -- complain if script is sourced in psql, rather than via CREATE EXTENSION
-\echo Use "CREATE EXTENSION uuid-ossp" to load this file. \quit
+\echo Use CREATE EXTENSION "uuid-ossp" to load this file. \quit

 ALTER EXTENSION "uuid-ossp" ADD function uuid_nil();
 ALTER EXTENSION "uuid-ossp" ADD function uuid_ns_dns();
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Noname (#1)
Re: Minor patch for the uuid-ossp extension

roadrunner6@gmx.at writes:

When trying to add the extension with \i it writes an error message:
Use "CREATE EXTENSION uuid-ossp" to load this file.

Unfortunatly this does not work for extensions with dashes. Must CREATE
EXTENSION "uuid-ossp". Proposed patch is attached.

[ memo to self: never, ever accept another contrib module whose name
isn't a plain SQL identifier ]

Yeah, that's a problem, but I don't find your solution acceptable:

-\echo Use "CREATE EXTENSION uuid-ossp" to load this file. \quit
+\echo Use CREATE EXTENSION "uuid-ossp" to load this file. \quit

That's just ignoring the English text quoting convention that these
messages are trying to follow. I guess we could shade the convention a
bit by using single not double quotes around the recommended command.
psql doesn't make that tremendously easy, but a bit of experimentation
says this works:

regression=# \echo Use '''CREATE EXTENSION "uuid-ossp"''' to load this file.
Use 'CREATE EXTENSION "uuid-ossp"' to load this file.

Does that look reasonable to people?

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Tom Lane (#2)
Re: Minor patch for the uuid-ossp extension

Tom Lane wrote:

roadrunner6@gmx.at writes:

regression=# \echo Use '''CREATE EXTENSION "uuid-ossp"''' to load this file.
Use 'CREATE EXTENSION "uuid-ossp"' to load this file.

Does that look reasonable to people?

+1

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Andrew Dunstan
andrew@dunslane.net
In reply to: Alvaro Herrera (#3)
Re: Minor patch for the uuid-ossp extension

On 11/22/2013 10:19 AM, Alvaro Herrera wrote:

Tom Lane wrote:

roadrunner6@gmx.at writes:
regression=# \echo Use '''CREATE EXTENSION "uuid-ossp"''' to load this file.
Use 'CREATE EXTENSION "uuid-ossp"' to load this file.

Does that look reasonable to people?

+1

+1

cheers

andrew

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#5Mario Weilguni
roadrunner6@gmx.at
In reply to: Tom Lane (#2)
Re: Minor patch for the uuid-ossp extension

Am 22.11.2013 16:15, schrieb Tom Lane:

[ memo to self: never, ever accept another contrib module whose name
isn't a plain SQL identifier ]

Well, in that case and since this is a rarely used extension (I guess
so), maybe it would be the best to simply rename that extension to
uuidossp (or whatever) and don't make any special treatment for it?

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#6Vik Fearing
vik.fearing@dalibo.com
In reply to: Mario Weilguni (#5)
Re: Minor patch for the uuid-ossp extension

On 11/23/2013 01:12 PM, Mario Weilguni wrote:

Am 22.11.2013 16:15, schrieb Tom Lane:

[ memo to self: never, ever accept another contrib module whose name
isn't a plain SQL identifier ]

Well, in that case and since this is a rarely used extension (I guess
so), maybe it would be the best to simply rename that extension to
uuidossp (or whatever) and don't make any special treatment for it?

It'll definitely cause pain, but I'm all for normalizing the contrib
names on sql identifiers, and this is the only outlier.

--
Vik

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

In reply to: Mario Weilguni (#5)
Re: Minor patch for the uuid-ossp extension

23.11.2013 14:12, Mario Weilguni kirjoitti:

Am 22.11.2013 16:15, schrieb Tom Lane:

[ memo to self: never, ever accept another contrib module whose name
isn't a plain SQL identifier ]

Well, in that case and since this is a rarely used extension (I guess
so), maybe it would be the best to simply rename that extension to
uuidossp (or whatever) and don't make any special treatment for it?

There are a couple of threads about issues with uuid-ossp (AIUI it's
abandonware at this point). If PostgreSQL had a proper PRNG with a
128-bit state it could just implement uuid_generate_v4() function in
core and most people could probably drop uuid-ossp.

I have a branch[1]https://github.com/saaros/postgres/compare/core-uuid-v4 which implements uuid_generate_v4 in core using
pg_lrand48, but since it only has 48 bits of state it's probably not an
acceptable replacement for uuid-ossp for now.

Is anyone working on a new PRNG for PostgreSQL at the moment?

/ Oskari

[1]: https://github.com/saaros/postgres/compare/core-uuid-v4

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#8Peter Eisentraut
peter_e@gmx.net
In reply to: Mario Weilguni (#5)
Re: Minor patch for the uuid-ossp extension

On 11/23/13, 7:12 AM, Mario Weilguni wrote:

Well, in that case and since this is a rarely used extension (I guess
so), maybe it would be the best to simply rename that extension to
uuidossp (or whatever) and don't make any special treatment for it?

Why? This is a solved problem, and renaming the extension would only
cause unnecessary work.

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers