Обсуждение: BUG #7820: Extension uuid-ossp cannot be installed on Windows - getting syntax error
BUG #7820: Extension uuid-ossp cannot be installed on Windows - getting syntax error
От
Jan-Peter.Seifert@gmx.de
Дата:
The following bug has been logged on the website: Bug reference: 7820 Logged by: Jan-Peter Seifert Email address: Jan-Peter.Seifert@gmx.de PostgreSQL version: 9.1.7 Operating system: Windows 7 64-bit Description: = The statement: 'CREATE EXTENSION uuid-ossp' just gives me a syntax error: ERROR: syntax error at or near "-" LINE 1: CREATE EXTENSION uuid-ossp ^ ********** Fehler ********** ERROR: syntax error at or near "-" SQL Status:42601 Zeichen:22 Obviously "CREATE EXTENSION" expects underscores instead of hyphens. I had to replace the hyphen in file names and in the scripts to make the module work.
Re: BUG #7820: Extension uuid-ossp cannot be installed on Windows - getting syntax error
От
Heikki Linnakangas
Дата:
On 22.01.2013 15:31, Jan-Peter.Seifert@gmx.de wrote: > The statement: > 'CREATE EXTENSION uuid-ossp' > > just gives me a syntax error: > > ERROR: syntax error at or near "-" > LINE 1: CREATE EXTENSION uuid-ossp > ^ > ********** Fehler ********** > > ERROR: syntax error at or near "-" > SQL Status:42601 > Zeichen:22 > > Obviously "CREATE EXTENSION" expects underscores instead of hyphens. Try: CREATE EXTENSION "uuid-ossp" - Heikki
On Tue, Jan 22, 2013 at 2:31 PM, <Jan-Peter.Seifert@gmx.de> wrote: > The statement: > 'CREATE EXTENSION uuid-ossp' > > just gives me a syntax error: > > ERROR: syntax error at or near "-" > LINE 1: CREATE EXTENSION uuid-ossp > ^ > ********** Fehler ********** > > ERROR: syntax error at or near "-" > SQL Status:42601 > Zeichen:22 > > Obviously "CREATE EXTENSION" expects underscores instead of hyphens. > > I had to replace the hyphen in file names and in the scripts to make the > module work. > This is not a bug. You need to quote identifiers that have non-identifier characters in them, like so: CREATE EXTENSION "uuid-ossp"; Vik
Am 22.01.2013 um 14:31 schrieb Jan-Peter.Seifert@gmx.de: > The following bug has been logged on the website: >=20 > Bug reference: 7820 > Logged by: Jan-Peter Seifert > Email address: Jan-Peter.Seifert@gmx.de > PostgreSQL version: 9.1.7 > Operating system: Windows 7 64-bit > Description: =20 >=20 > The statement: > 'CREATE EXTENSION uuid-ossp' >=20 > just gives me a syntax error: >=20 > ERROR: syntax error at or near "-" > LINE 1: CREATE EXTENSION uuid-ossp > ^ > ********** Fehler ********** >=20 > ERROR: syntax error at or near "-" > SQL Status:42601 > Zeichen:22 >=20 > Obviously "CREATE EXTENSION" expects underscores instead of hyphens. no. Your syntax is wrong. >=20 > I had to replace the hyphen in file names and in the scripts to make = the > module work. >=20 That is the wrong "fix". The hyphen has a meaning in SQL. So you need = to properly enclose uuid-ossp in quotes.
Heikki Linnakangas <hlinnakangas@vmware.com> writes: > On 22.01.2013 15:31, Jan-Peter.Seifert@gmx.de wrote: > Try: > CREATE EXTENSION "uuid-ossp" Although this isn't a bug, it does seem like a usability fail. Did we make a conscious decision not to call the extension uuid_ossp? I can't remember one way or the other. It's probably too late to change now, though :-( regards, tom lane
Re: BUG #7820: Extension uuid-ossp cannot be installed on Windows - getting syntax error
От
Jan-Peter Seifert
Дата:
Am 22.01.2013 14:47, schrieb Marc Balmer: > no. Your syntax is wrong. Well - it's not exactly 'my' syntax - see: uuid-ossp--1.0.sql uuid-ossp--unpackaged--1.0.sql >> I had to replace the hyphen in file names and in the scripts to make the >> module work. >> > That is the wrong "fix". The hyphen has a meaning in SQL. So you need to properly enclose uuid-ossp in quotes. I didn't think about the fact that extensions are database objects, too. It's a bit annoying that this extension has non-standard characters in its name though. It's the only one from all that currently exist.
Re: BUG #7820: Extension uuid-ossp cannot be installed on Windows - getting syntax error
От
Daniel Farina
Дата:
On Tue, Jan 22, 2013 at 10:26 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > Heikki Linnakangas <hlinnakangas@vmware.com> writes: >> On 22.01.2013 15:31, Jan-Peter.Seifert@gmx.de wrote: >> Try: >> CREATE EXTENSION "uuid-ossp" > > Although this isn't a bug, it does seem like a usability fail. > Did we make a conscious decision not to call the extension uuid_ossp? > I can't remember one way or the other. It's probably too late to change > now, though :-( I sort of have good recollection of the history here, I think, because people have asked me about it quite a few times.... uuid-ossp.sql, pre CREATE EXTENSION was always named as such, so carrying forward the most obvious port to CREATE EXTENSION results in a non-SQL safe identifier. Pre CREATE EXTENSION it didn't seem obvious that it would matter how the extension would be named, as long as it looked okay in psql -f or psql \i, which it did. Considering the history, most people seem to understand how things ended up in this way, although it's still a little annoying, and definitely confusing. -- fdr