Short version: using the “Add Column” GUI on an existing table puts double quotes around the datatype, and won’t run.
Long version:
Using pgAdmin III Version 1.2.0 Beta 1 (Sep 8 2004) on Windows 2000, fully patched from Windows Update site. Connecting to PostgreSQL 7.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)")
Opened “Servers” à <my server name> à “Databases” à <my database name> à “Schemas” à “public” à “Tables” and single-clicked on my table name to highlight it.
Right clicked on the table name and chose “Properties”.
The Table dialog box has “Properties” “Columns” “Constraints” “Privileges” and “SQL” tabs; clicked on “Columns”.
Clicked on the “Add” button at the bottom.
In the New Column dialog box, I entered:
Name= user_surname
Datatype= varchar
Length= 80
I left all other available properties “Default Value” “Not Null” “Statistics” and “Comment” at the default of blank.
Clicked OK to close the New Column dialog box.
>>> Back on the Table à 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.
On the Table dialog box, click OK. I receive an error message ERROR: syntax error at or near “(“ at character 67.
I clear the error and go to the Table à SQL tab. I have copied its SQL here:
ALTER TABLE <my table name> ADD COLUMN user_surname "varchar"(80);
I removed the double quotes around varchar, and executed the SQL directly, with no errors.
Thanks,
Ted Tayloor
ted.taylor@aircanada.ca