pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
%Alter Help
3+ messages / 3 participants
[nested] [flat]

* %Alter Help
@ 2006-07-10 21:55  KyLiE <citlali.guerrero@inegi.gob.mx>
  0 siblings, 1 reply; 3+ messages in thread

From: KyLiE @ 2006-07-10 21:55 UTC (permalink / raw)
  To: pgsql-admin

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.

Any help I'll appreciate .

Regards.




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: %Alter Help
@ 2006-07-10 23:57  Michael Fuhr <mike@fuhr.org>
  parent: KyLiE <citlali.guerrero@inegi.gob.mx>
  0 siblings, 1 reply; 3+ messages in thread

From: Michael Fuhr @ 2006-07-10 23:57 UTC (permalink / raw)
  To: KyLiE <citlali.guerrero@inegi.gob.mx>; +Cc: pgsql-admin

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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: %Alter Help
@ 2006-07-11 10:55  Andy Shellam <andy@andycc.net>
  parent: Michael Fuhr <mike@fuhr.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Andy Shellam @ 2006-07-11 10:55 UTC (permalink / raw)
  To: 'KyLiE' <citlali.guerrero@inegi.gob.mx>; +Cc: pgsql-admin

To start off with, I would say it's that "ALTER TABLE" statement first.

I believe, as Michael said, it should be

ALTER COLUMN lugar.sitio TYPE varchar2(500)
Or ALTER COLUMN lugar.sitio TYPE varchar(500)

Andy

> -----Original Message-----
> From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-
> owner@postgresql.org] On Behalf Of Michael Fuhr
> Sent: 11 July 2006 12:58 am
> To: KyLiE
> Cc: pgsql-admin@postgresql.org
> Subject: Re: [ADMIN] %Alter Help
> 
> 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
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
>        subscribe-nomail command to majordomo@postgresql.org so that your
>        message can get through to the mailing list cleanly
> 
> !DSPAM:14,44b2edbc34535200862907!
> 





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2006-07-11 10:55 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-07-10 21:55 %Alter Help KyLiE <citlali.guerrero@inegi.gob.mx>
2006-07-10 23:57 ` Michael Fuhr <mike@fuhr.org>
2006-07-11 10:55   ` Andy Shellam <andy@andycc.net>

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