X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5B68CD1B503 for ; Tue, 28 Oct 2003 17:06:03 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 25994-03 for ; Tue, 28 Oct 2003 13:05:32 -0400 (AST) Received: from mail.deltav.hu (oldmail.deltav.hu [213.163.0.192]) by svr1.postgresql.org (Postfix) with ESMTP id 08E1ED1B52D for ; Tue, 28 Oct 2003 13:05:31 -0400 (AST) Received: from fejleszt4 ([213.163.10.103]) by mail.deltav.hu (Netscape Messaging Server 3.6) with SMTP id AAA73FE for ; Tue, 28 Oct 2003 18:03:21 +0100 Message-ID: <076b01c39d75$3d677270$0403a8c0@fejleszt4> From: =?ISO-8859-1?Q?SZUCS_G=E1bor?= To: References: <64184.138.88.163.115.1067274631.squirrel@physics.gmu.edu> Subject: Re: URGENT!!! changing Column size Date: Tue, 28 Oct 2003 18:02:14 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.7 tagged_above=0.0 required=5.0 tests=BAYES_30, PLING_PLING, QUOTED_EMAIL_TEXT, REFERENCES X-Spam-Level: X-Archive-Number: 200310/369 X-Sequence-Number: 15769 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: 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