pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Fuhr <mike@fuhr.org>
To: KyLiE <citlali.guerrero@inegi.gob.mx>
Cc: pgsql-admin@postgresql.org
Subject: Re: %Alter Help
Date: Mon, 10 Jul 2006 17:57:30 -0600
Message-ID: <20060710235730.GA2627@winnie.fuhr.org> (raw)
In-Reply-To: <44B2CCDC.9060407@inegi.gob.mx>
References: <44B2CCDC.9060407@inegi.gob.mx>

On Mon, Jul 10, 2006 at 04:55:40PM -0500, KyLiE wrote:
> Hi all, I have a new question, know i'm trying to alter one of my 
> tables,but the thing is, that I need to change the range of one of my 
> columns, I've allready try this:
> 
> ALTER TABLE lugar alter column sitio varchar2(500);
> 
> but it gives me a syntax error. and i don't know why.

What's the exact error message and what version of PostgreSQL are
you running?  At least three things could be contributing to the
error:

1. The syntax for altering a column's type is

   ALTER [ COLUMN ] column TYPE type [ USING expression ]

   The command you showed is missing the word "TYPE".

2. Altering a column's type is supported only in PostgreSQL 8.0 and
   later; if you're using 7.4 or earlier then you'll need to perform
   the steps shown in the FAQ:

   http://www.postgresql.org/docs/faqs.FAQ.html#item4.3

3. PostgreSQL doesn't have a builtin varchar2 type.  Unless you've
   added varchar2 then use varchar instead.

Try this:

ALTER TABLE lugar ALTER COLUMN sitio TYPE varchar(500);

-- 
Michael Fuhr



view thread (3+ messages)  latest in thread

Message-ID: <20060710235730.GA2627@winnie.fuhr.org>
Permalink:  ../20060710235730.GA2627@winnie.fuhr.org/
Also on:    postgresql.org/message-id/20060710235730.GA2627@winnie.fuhr.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: mike@fuhr.org, citlali.guerrero@inegi.gob.mx
  Subject: Re: %Alter Help
  In-Reply-To: <20060710235730.GA2627@winnie.fuhr.org>
  References: <44B2CCDC.9060407@inegi.gob.mx> <20060710235730.GA2627@winnie.fuhr.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox