From: SZUCS Gábor <surrano@mailbox.hu>
To: pgsql-sql@postgresql.org
Subject: Re: URGENT!!! changing Column size
Date: Tue, 28 Oct 2003 18:02:14 +0100
Message-ID: <076b01c39d75$3d677270$0403a8c0@fejleszt4> (raw)
References: <64184.138.88.163.115.1067274631.squirrel@physics.gmu.edu>
I have a php script that patches database, comparing pg_catalog's tables to
input files. One thing it can do, but I can't take responsibility ;) is
changing the type of a column.
It's basically the same that everyone wrote, except that I also examine
dependencies, as broad an examination as I could think about.
However; the code is not yet ready, and not my exclusive possession, but the
steps I could tell you are:
1. Note oid:
SELECT oid, relname from pg_class WHERE relname='institution'
2. Identify the attribute:
SELECT * from pg_attribute WHERE attrelid = xxx AND ...
3. Search for depends:
SELECT d.*
FROM pg_depend d, pg_attribute a
WHERE refobjid=a.attrelid and refobjsubid=a.attnum
AND ...
-- you are on your own here ;)
4. Drop those dependencies (more likely, foreign keys, constraints, indexes)
5. Do the change
6. Apply dependencies.
HTH,
G.
------------------------------- cut here -------------------------------
----- Original Message -----
From: <mohan@physics.gmu.edu>
Sent: Monday, October 27, 2003 6:10 PM
> Hi can we change the size of a column in postgres. I have a table named
> institution and column name is name varchar2(25), i want to change it to
> varchar2(50). Please let me know.
>
> --Mohan
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: surrano@mailbox.hu
Subject: Re: URGENT!!! changing Column size
In-Reply-To: <076b01c39d75$3d677270$0403a8c0@fejleszt4>
* 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