Web pgadmin.org
 Home 
 ·  ·  ·  ·  ·  ·  · 
Bug regarding SQL identifiers

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 == '_'))
             {


Home | Main Index | Thread Index

top