Error adding new column to existing table. - Mailing list pgadmin-support

From Ted Taylor
Subject Error adding new column to existing table.
Date
Msg-id 000e01c49c2e$ef5350e0$5281ce9f@TAG65144419
Whole thread Raw
List pgadmin-support
<div class="Section1"><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">Short version: using the “Add Column” GUI on an existing table puts double quotes around the
datatype,and won’t run.</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">Long version:</span></font><p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size:10.0pt;
font-family:Arial">Using pgAdmin III Version 1.2.0 Beta 1 (</span></font><font face="Arial" size="2"><span
style="font-size:10.0pt;font-family:Arial">Sep 8 2004</span></font><font face="Arial" size="2"><span
style="font-size:10.0pt;font-family:Arial">)on Windows 2000, fully patched from Windows Update site.  Connecting to
PostgreSQL7.4.5 on Fedora Core 2 (select version() reports “"PostgreSQL 7.4.5 on i686-redhat-linux-gnu, compiled by GCC
gcc(GCC) 3.3.3 20040412 (Red Hat Linux 3.3.3-7)")</span></font><p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size:10.0pt;
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">Opened “Servers” </span></font><font face="Wingdings" size="2"><span
style="font-size:10.0pt;font-family:Wingdings">à</span></font><fontface="Arial" size="2"><span
style="font-size:10.0pt;font-family:Arial"><my server name> </span></font><font face="Wingdings" size="2"><span
style="font-size:10.0pt;font-family:Wingdings">à</span></font><fontface="Arial" size="2"><span
style="font-size:10.0pt;font-family:Arial">“Databases” </span></font><font face="Wingdings" size="2"><span
style="font-size:10.0pt;
font-family:Wingdings">à</span></font><font face="Arial" size="2"><span style="font-size:10.0pt;font-family:Arial">
<mydatabase name> </span></font><font face="Wingdings" size="2"><span
style="font-size:10.0pt;font-family:Wingdings">à</span></font><fontface="Arial" size="2"><span
style="font-size:10.0pt;font-family:Arial">“Schemas” </span></font><font face="Wingdings" size="2"><span
style="font-size:10.0pt;
font-family:Wingdings">à</span></font><font face="Arial" size="2"><span style="font-size:10.0pt;font-family:Arial">
“public”</span></font><font face="Wingdings" size="2"><span
style="font-size:10.0pt;font-family:Wingdings">à</span></font><fontface="Arial" size="2"><span
style="font-size:10.0pt;font-family:Arial">“Tables” and single-clicked on my table name to highlight
it.</span></font><pclass="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
 
font-family:Arial">Right clicked on the table name and chose “Properties”.</span></font><p class="MsoNormal"><font
face="Arial"size="2"><span style="font-size:10.0pt;
 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">The Table dialog box has “Properties” “Columns” “Constraints” “Privileges” and “SQL” tabs; clicked
on“Columns”.</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
 
font-family:Arial">Clicked on the “Add”  button at the bottom.</span></font><p class="MsoNormal"><font face="Arial"
size="2"><spanstyle="font-size:10.0pt;
 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">In the New Column dialog box, I entered:</span></font><p class="MsoNormal"><font face="Arial"
size="2"><spanstyle="font-size:10.0pt;
 
font-family:Arial">            Name=      user_surname</span></font><p class="MsoNormal"><font face="Arial"
size="2"><spanstyle="font-size:10.0pt;
 
font-family:Arial">            Datatype=         varchar</span></font><p class="MsoNormal"><font face="Arial"
size="2"><spanstyle="font-size:10.0pt;
 
font-family:Arial">            Length=            80</span></font><p class="MsoNormal"><font face="Arial"
size="2"><spanstyle="font-size:10.0pt;
 
font-family:Arial">I left all other available properties “Default Value” “Not Null” “Statistics” and “Comment” at the
defaultof blank.</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">Clicked OK to close the New Column dialog box.</span></font><p class="MsoNormal"><font face="Arial"
size="2"><spanstyle="font-size:10.0pt;
 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">>>> Back on the Table </span></font><font face="Wingdings" size="2"><span
style="font-size:10.0pt;font-family:Wingdings">à</span></font><fontface="Arial" size="2"><span
style="font-size:10.0pt;font-family:Arial">Columns dialog box, I notice the keyword “varchar” has double quotes around
it. Other datatypes such as “int4” do not have double quotes around it.</span></font><p class="MsoNormal"><font
face="Arial"size="2"><span style="font-size:10.0pt;
 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">On the Table dialog box, click OK.  I receive an error message ERROR: syntax error at or near “(“ at
character67.</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">I clear the error and go to the Table </span></font><font face="Wingdings" size="2"><span
style="font-size:10.0pt;font-family:Wingdings">à</span></font><fontface="Arial" size="2"><span
style="font-size:10.0pt;font-family:Arial">SQL tab.  I have copied its SQL here:</span></font><p
class="MsoNormal"><fontface="Arial" size="2"><span style="font-size:10.0pt;
 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">ALTER TABLE <my table name> ADD COLUMN user_surname "varchar"(80);</span></font><p
class="MsoNormal"><fontface="Arial" size="2"><span style="font-size:10.0pt;
 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">I removed the double quotes around varchar, and executed the SQL directly, with no
errors.</span></font><pclass="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">Thanks,</span></font><p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size:10.0pt;
font-family:Arial">Ted Tayloor</span></font><p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size:10.0pt;
font-family:Arial">ted.taylor@aircanada.ca</span></font><p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size:10.0pt;
font-family:Arial"> </span></font></div>

pgadmin-support by date:

Previous
From: "Michal Unzeitig"
Date:
Subject: Data insert & column name problems
Next
From: "Dave Page"
Date:
Subject: Re: Error adding new column to existing table.