pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedModify column type
2+ messages / 2 participants
[nested] [flat]
* Modify column type
@ 2002-08-19 16:45 Scott David Walter <sdw1@geneseo.edu>
0 siblings, 1 reply; 2+ messages in thread
From: Scott David Walter @ 2002-08-19 16:45 UTC (permalink / raw)
To: pgsql-sql
Is there a way to modify the type of an existing column? All I actually
want to do is extend the length of the type from a VARCHAR(6) to
VARCHAR(100).
Column | Type | Modifiers
------------------------+-----------------------+------------------------
email | character varying(6) | not null
gold_program=> ALTER TABLE student MODIFY email varchar(100);
ERROR: parser: parse error at or near "modify"
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Modify column type
@ 2002-08-20 01:56 Christopher Kings-Lynne <chriskl@familyhealth.com.au>
parent: Scott David Walter <sdw1@geneseo.edu>
0 siblings, 0 replies; 2+ messages in thread
From: Christopher Kings-Lynne @ 2002-08-20 01:56 UTC (permalink / raw)
To: Scott David Walter <sdw1@geneseo.edu>; pgsql-sql
Hi Scott,
I believe you can hack the catalogs: (disclaimer)
update pg_attribute set atttypmod=104 where attname='email' and
attrelid=(select oid from pg_class where relname='student');
Do this in a transaction and then \d the table to check that it has worked
before committing.
Chris
> -----Original Message-----
> From: pgsql-sql-owner@postgresql.org
> [mailto:pgsql-sql-owner@postgresql.org]On Behalf Of Scott David Walter
> Sent: Tuesday, 20 August 2002 12:46 AM
> To: pgsql-sql@postgresql.org
> Subject: [SQL] Modify column type
>
>
> Is there a way to modify the type of an existing column? All I actually
> want to do is extend the length of the type from a VARCHAR(6) to
> VARCHAR(100).
>
>
> Column | Type | Modifiers
> ------------------------+-----------------------+------------------------
> email | character varying(6) | not null
>
>
> gold_program=> ALTER TABLE student MODIFY email varchar(100);
> ERROR: parser: parse error at or near "modify"
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2002-08-20 01:56 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-08-19 16:45 Modify column type Scott David Walter <sdw1@geneseo.edu>
2002-08-20 01:56 ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
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