From jkanter@virginia.edu Mon Mar 24 19:00:18 2003 X-Original-To: pgsql-admin@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id AACFF476178 for ; Mon, 24 Mar 2003 14:00:18 -0500 (EST) Received: from mail.virginia.edu (mail.Virginia.EDU [128.143.2.9]) by postgresql.org (Postfix) with SMTP id AE947475A4B for ; Mon, 24 Mar 2003 14:00:16 -0500 (EST) Received: from smtp.mail.virginia.edu by mail.virginia.edu id aa16055; 24 Mar 2003 13:59 EST Received: from jlk3xpc (d-128-19-222.bootp.Virginia.EDU [128.143.19.222]) by smtp.mail.Virginia.EDU (8.11.6p/8.11.6) with SMTP id h2OIxjh35820 for ; Mon, 24 Mar 2003 13:59:46 -0500 Message-ID: <00c601c2f238$61f67f70$de138f80@virginia.edu> From: Jodi Kanter To: Postgres Admin List Subject: alter table Date: Mon, 24 Mar 2003 14:05:49 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00C3_01C2F20E.79004540" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Spam-Status: No, hits=1.0 required=5.0 tests=ASCII_FORM_ENTRY,HTML_60_70,HTML_WITH_BGCOLOR version=2.50 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200303/402 X-Sequence-Number: 8042 This is a multi-part message in MIME format. ------=_NextPart_000_00C3_01C2F20E.79004540 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Is it possible to modify a column data type? I don't see it in the docs but= thought I remembered something crossing this list regarding a modify comma= nd? Thanks Jodi _______________________________ Jodi L Kanter BioInformatics Database Administrator University of Virginia (434) 924-2846 jkanter@virginia.edu =20 =20 =20 ------=_NextPart_000_00C3_01C2F20E.79004540 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Is it possible to modify a column data = type? I=20 don't see it in the docs but thought I remembered something crossing this l= ist=20 regarding a modify command?
Thanks
Jodi

_______________________________
Jodi=20 L Kanter
BioInformatics Database Administrator
University of=20 Virginia
(434) 924-2846
jkanter@virginia.edu

 

 

 

<= /DIV> ------=_NextPart_000_00C3_01C2F20E.79004540-- From xzilla@users.sourceforge.net Mon Mar 24 19:21:50 2003 X-Original-To: pgsql-admin@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8778747633A for ; Mon, 24 Mar 2003 14:21:50 -0500 (EST) Received: from localhost.localdomain (unknown [65.217.53.66]) by postgresql.org (Postfix) with ESMTP id B9665476326 for ; Mon, 24 Mar 2003 14:21:48 -0500 (EST) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by localhost.localdomain (8.12.5/8.12.5) with ESMTP id h2OJuV6P002718; Mon, 24 Mar 2003 14:56:31 -0500 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [192.168.3.55]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id h2OJLlp24303; Mon, 24 Mar 2003 14:21:48 -0500 Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id F3HTKQT1; Mon, 24 Mar 2003 14:21:46 -0500 Subject: Re: alter table From: Robert Treat To: Jodi Kanter Cc: Postgres Admin List In-Reply-To: <00c601c2f238$61f67f70$de138f80@virginia.edu> References: <00c601c2f238$61f67f70$de138f80@virginia.edu> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 24 Mar 2003 14:21:47 -0500 Message-Id: <1048533707.13798.320.camel@camel> Mime-Version: 1.0 X-Spam-Status: No, hits=-38.0 required=5.0 tests=BAYES_10,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES,USER_AGENT_XIMIAN autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200303/406 X-Sequence-Number: 8046 On Mon, 2003-03-24 at 14:05, Jodi Kanter wrote: > Is it possible to modify a column data type? I don't see it in the docs > but thought I remembered something crossing this list regarding a modify > command? > Thanks > Jodi > You can do it by hacking at reltype in pg_class, though this will probably only work if your data types are binary compatible, and even then there might be some issues. Read thoroughly chapter 3 of the developers guide and make sure to test on a development database before trying to do this on anything resembling a production system. Robert Treat From mark@vestnesis.lv Wed Jun 4 15:01:55 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 42962EFEA7 for ; Wed, 4 Jun 2003 15:01:55 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 81876-10 for ; Wed, 4 Jun 2003 15:01:53 +0000 (GMT) Received: from latvestn (mail.vestnesis.lv [80.232.239.6]) by svr1.postgresql.org (Postfix) with ESMTP id C670FEFE9B for ; Wed, 4 Jun 2003 15:01:52 +0000 (GMT) Received: (from mail@localhost) by latvestn (8.12.9/8.11.1) id h54FLTfG092123 for pgsql-admin@postgresql.org; Wed, 4 Jun 2003 18:21:29 +0300 (EEST) (envelope-from mark@vestnesis.lv) X-Authentication-Warning: latvestn: mail set sender to mark@vestnesis.lv using -f Received: from 10.11.12.15 by 64.117.224.193 id FjuETsUA ; 4 Jun 2003 18:21:27 EEST Received: from varde (ws.vestnesis.lv [10.11.12.30] (may be forged)) by vestnesis.lv (8.11.6/8.11.6/SuSE Linux 0.5) with ESMTP id h54E1Ec25150 for ; Wed, 4 Jun 2003 17:01:15 +0300 Content-Type: text/plain; charset="iso-8859-13" From: Martins Zarins To: pgsql-admin@postgresql.org Subject: ALTER TABLE Date: Wed, 4 Jun 2003 18:05:10 +0300 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200306041805.10202.mark@vestnesis.lv> X-Spam-Status: No, hits=0.7 tagged_above=0.0 required=5.0 tests=SUBJ_ALL_CAPS, USER_AGENT_KMAIL, X_AUTH_WARNING X-Spam-Level: * X-Archive-Number: 200306/15 X-Sequence-Number: 9006 Hello! Can someone explain me, why last ALTER fails? work=3D# \d rdu Table "rdu" Column | Type | Modifiers=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 -------------+-----------------------------+-------------------------------= ----------------- id | integer | not null default=20 nextval('"rdu_id_seq"'::text) numurs | integer |=20 versija | integer |=20 klients_id | integer |=20 pasutitajs | text |=20 agents_id | integer |=20 pasut_nr | integer |=20 status_id | character varying(1) | default 'S' start_time | timestamp without time zone | not null default now() end_time | timestamp without time zone |=20 finish_time | timestamp without time zone |=20 apraksts | text |=20 Indexes: rdu_agents_id, rdu_klients_id Unique keys: rdu_id_key Triggers: RI_ConstraintTrigger_1187649, RI_ConstraintTrigger_1187655, RI_ConstraintTrigger_1187673, RI_ConstraintTrigger_1187675 work=3D# ALTER TABLE rdu ADD CONSTRAINT rdu_end_time CHECK ((start_time <= =3D=20 end_time) OR end_time IS NULL); ALTER work=3D# ALTER TABLE rdu ADD CONSTRAINT rdu_finish_time CHECK ((start_time = <=3D=20 finish_time) OR finish_time IS NULL); ERROR: AlterTableAddConstraint: rejected due to CHECK constraint=20 rdu_finish_time psql (PostgreSQL) 7.2.3 Mark From bhuvan@symonds.net Thu Jun 5 07:29:07 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 84A58EFFE7 for ; Thu, 5 Jun 2003 07:29:07 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 30764-04 for ; Thu, 5 Jun 2003 07:29:02 +0000 (GMT) Received: from Gateway.bksys.co.in (unknown [61.3.64.10]) by svr1.postgresql.org (Postfix) with ESMTP id E4157EFFDB for ; Thu, 5 Jun 2003 07:28:59 +0000 (GMT) Received: from bksys.co.in (mail.bksys.co.in [192.168.1.1]) by Gateway.bksys.co.in (8.11.6/8.11.6) with ESMTP id h557Sr514879; Thu, 5 Jun 2003 12:58:54 +0530 Received: from Bhuvan.bksys.co.in (Bhuvan.bksys.co.in [192.168.1.71]) by bksys.co.in (8.11.6/8.8.5) with ESMTP id h557SrJ23688; Thu, 5 Jun 2003 12:58:53 +0530 Date: Thu, 5 Jun 2003 12:54:45 +0530 (IST) From: "A.Bhuvaneswaran" X-X-Sender: bhuvan@Bhuvan.bksys.co.in To: Martins Zarins Cc: pgsql-admin@postgresql.org Subject: Re: ALTER TABLE In-Reply-To: <200306041805.10202.mark@vestnesis.lv> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200306/17 X-Sequence-Number: 9008 > work=# ALTER TABLE rdu ADD CONSTRAINT rdu_finish_time CHECK ((start_time <= > finish_time) OR finish_time IS NULL); > ERROR: AlterTableAddConstraint: rejected due to CHECK constraint > rdu_finish_time I can say that the field, finish_time have the values which conflict with the check constraint you define. ie.. Records exist with start_time > finish_time, so update the records and try. regards, bhuvaneswaran From viktors.jegorovs@nordlb.lv Thu Jun 5 07:25:24 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id CEED8EFFDB for ; Thu, 5 Jun 2003 07:25:24 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 29839-06 for ; Thu, 5 Jun 2003 07:25:23 +0000 (GMT) Received: from shield.nordlb.lv (shield.pirmabanka.lv [195.114.57.4]) by svr1.postgresql.org (Postfix) with ESMTP id 5373CEFFB8 for ; Thu, 5 Jun 2003 07:25:21 +0000 (GMT) Received: from wall2.pirmabanka.lv (wall2-pub.nordlb.lv [195.114.57.14]) by shield.nordlb.lv (8.12.9/8.12.9) with SMTP id h557PJGZ014407 for ; Thu, 5 Jun 2003 10:25:19 +0300 Received: from share.nordlb.lv ([10.0.0.10]) by wall2.pirmabanka.lv; Thu, 05 Jun 2003 10:25:19 +0300 (EET DST) Received: from pc311x1.nordlb.lv (localhost.localdomain [127.0.0.1]) by nordlb.lv (8.11.6/8.11.6) with SMTP id h557PGh01146 for ; Thu, 5 Jun 2003 10:25:18 +0300 Received: (qmail 30639 invoked by uid 100); 5 Jun 2003 07:28:05 -0000 Date: Thu, 5 Jun 2003 10:28:05 +0300 From: "Victor Yegorov" To: Martins Zarins Cc: pgsql-admin@postgresql.org Subject: Re: ALTER TABLE Message-ID: <20030605072805.GN23596@nordlb.lv> Mail-Followup-To: Martins Zarins , pgsql-admin@postgresql.org References: <200306041805.10202.mark@vestnesis.lv> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <200306041805.10202.mark@vestnesis.lv> User-Agent: Mutt/1.4.1i X-Archive-Number: 200306/18 X-Sequence-Number: 9009 * Martins Zarins [05.06.2003 10:18]: > Hello! > Can someone explain me, why last ALTER fails? > > work=# \d rdu > Table "rdu" > Column | Type | Modifiers > -------------+-----------------------------+------------------------------------------------ > id | integer | not null default > nextval('"rdu_id_seq"'::text) > numurs | integer | > versija | integer | > klients_id | integer | > pasutitajs | text | > agents_id | integer | > pasut_nr | integer | > status_id | character varying(1) | default 'S' > start_time | timestamp without time zone | not null default now() > end_time | timestamp without time zone | > finish_time | timestamp without time zone | > apraksts | text | > Indexes: rdu_agents_id, > rdu_klients_id > Unique keys: rdu_id_key > Triggers: RI_ConstraintTrigger_1187649, > RI_ConstraintTrigger_1187655, > RI_ConstraintTrigger_1187673, > RI_ConstraintTrigger_1187675 > > work=# ALTER TABLE rdu ADD CONSTRAINT rdu_end_time CHECK ((start_time <= > end_time) OR end_time IS NULL); > ALTER > work=# ALTER TABLE rdu ADD CONSTRAINT rdu_finish_time CHECK ((start_time <= > finish_time) OR finish_time IS NULL); > ERROR: AlterTableAddConstraint: rejected due to CHECK constraint > rdu_finish_time Perhaps you have some rows, for which check fails, i.e. (start_time > finish_time AND finish_time IS NOT NULL) is true. -- Victor Yegorov