473,416 Members | 1,559 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

syntax error at or near "TYPE"

66
Expand|Select|Wrap|Line Numbers
  1. ALTER TABLE public.postcodes
  2.   ALTER COLUMN machi
  3.   TYPE varchar(100);
Error: ERROR: syntax error at or near "TYPE";
Error while executing the query (State:42601, Native Code: 7)


I am using WinSQL, Windows XP SP2 Japanese Version, PostgreSQL 8.x.
I want to alter my machi field from varchar(30) to varchar(100) TYPE.

This is my CREATE TABLE script:
Expand|Select|Wrap|Line Numbers
  1. -- Table: public.postcodes
  2.  
  3. -- DROP TABLE public.postcodes;
  4.  
  5. CREATE TABLE public.postcodes (
  6.   postcode  varchar(8) NOT NULL,
  7.   post      varchar(6) NOT NULL,
  8.   kencd     varchar(3) NOT NULL,
  9.   ken       varchar(30) NOT NULL,
  10.   shicd     varchar(4) NOT NULL,
  11.   shi       varchar(30) NOT NULL,
  12.   ku        varchar(30),
  13.   machi     varchar(30) NOT NULL,
  14.   status    boolean,
  15.   remarks   text,
  16.   /* Keys */
  17.   CONSTRAINT postcodes_pkey
  18.     PRIMARY KEY (postcode)
  19. ) WITHOUT OIDS;
  20.  
  21. ALTER TABLE public.postcodes
  22.   OWNER TO postgres; 
Jul 26 '07 #1
3 12474
michaelb
534 Expert 512MB
Expand|Select|Wrap|Line Numbers
  1. ALTER TABLE public.postcodes  ALTER COLUMN machi  
  2.                      TYPE  varchar(100);
  3.  
This looks correct, but changing the column datatype was not supported in the versions prior to 8.x.
My first thought is you are running an earlier version of PostgreSQL.
Jul 30 '07 #2
eros
66
This looks correct, but changing the column datatype was not supported in the versions prior to 8.x.
My first thought is you are running an earlier version of PostgreSQL.
I am using PostgreSQL 7.4.1. Is there a documentation that the above scripts are not supported?.
Jul 31 '07 #3
michaelb
534 Expert 512MB
Of course it is all well documented.
Compare the ALTER TABLE command for 8.2 with that of 7.4 and you'll see the difference.
The commonly used work around is to add a new column, copy the values from the old one, than drop the old column
Aug 1 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: A.M-SG | last post by:
Hi, I am trying to simplify my app.config file. Can I have a section handler in a separated file? I am looking for something like this: <section name=".." type=".." file="..."> but it...
8
by: eminemence | last post by:
Hi, I have been trying to get STLPort work for Symbian. I am using CodeWarrior compiler and it spews this errors namely *************************************************************************...
7
by: Rich | last post by:
Is the link rel="stylesheet" supposed to be real plain text, or would some word processor format such as Word/Pad work? This sample stylesheet seems garbled if downloaded and opened with...
4
by: bob95226 | last post by:
Hi All, I wrote a VB.NET control in Visual Studio 2003 IDE, I am trying to re-compile it with command line compiler vbc.exe like this: vbc /t:library /out:my_control.dll my_control.vb However...
0
subashini Thiyagarajan
by: subashini Thiyagarajan | last post by:
Any one can help me in this error Error Type: Provider (0x80040E21) Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done....
2
abehm
by: abehm | last post by:
Hey everyone, I'm trying to input a string as an xml data type into sql server, but i keep getting this error. Am I doing this incorrectly, or do i need to format the string? XmlDocument mydoc...
17
imrosie
by: imrosie | last post by:
I've tried this string to Sum up payments, moving brackets and paren's different ways, I still get error 'type mismatch'....not sure why. Can anyone point me in the right direction?? thanks ...
24
by: carnold | last post by:
Hello, I'm a developer coming from C++ and Java ... I've going thru "Effective C#" (which highly recommend for people coming from other languages wanting to learn C#), and it states that "value...
9
by: Steve | last post by:
Hi; I've being going through some legacy code on an old JSP site I have been patching. I noticed that when I save the JSP down to my PC as an HTML file I get this javascript error in IE 6 ( ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.