Unix Technical Forum

Bug regarding SQL identifiers

This is a discussion on Bug regarding SQL identifiers within the pgsql Interfaces Pgadmin Hackers forums, part of the PostgreSQL category; --> Dear all, I tried to look at some tables created by another tool whose name starts with a number ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Interfaces Pgadmin Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-17-2008, 05:28 PM
Alexander Borkowski
 
Posts: n/a
Default Bug regarding SQL identifiers

Dear all,

I tried to look at some tables created by another tool whose name starts
with a number (e.g. 100_something) with pgAdmin III 1.2.0. Doing this
raises a PostgreSQL syntax error. I traced the cause to the needsQuoting
function in src/utils/misc.cpp. According to the PostgreSQL
documentation SQL identifiers are to be quoted if they don't start with
a-z or an underbar, in particular numbers as first characters are not
allowed. Attached you will find a patch which fixes this.

Cheers,

Alex

--- src/utils/misc.cpp.orig 2005-01-06 19:29:42.000000000 +1100
+++ src/utils/misc.cpp 2005-01-06 19:31:23.000000000 +1100
@@ -282,7 +282,7 @@
while (pos < (int)value.length())
{
wxChar c=value.GetChar(pos);
- if (!(c >= '0' && c <= '9') &&
+ if (!((pos > 0) && (c >= '0' && c <= '9')) &&
!(c >= 'a' && c <= 'z') &&
!(c == '_'))
{


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-17-2008, 05:28 PM
Andreas Pflug
 
Posts: n/a
Default Re: Bug regarding SQL identifiers

Alexander Borkowski wrote:
> Dear all,
>
> I tried to look at some tables created by another tool whose name starts
> with a number (e.g. 100_something) with pgAdmin III 1.2.0. Doing this
> raises a PostgreSQL syntax error. I traced the cause to the needsQuoting
> function in src/utils/misc.cpp. According to the PostgreSQL
> documentation SQL identifiers are to be quoted if they don't start with
> a-z or an underbar, in particular numbers as first characters are not
> allowed. Attached you will find a patch which fixes this.


Good catch, thanks for reporting. Fix applied to CVS

Regards,
Andreas

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:45 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com