From: | "Alexis Maldonado" <amaldona(at)ctcd(dot)cc(dot)tx(dot)us> |
---|---|
To: | <alvherre(at)atentus(dot)com> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Better late than sorry.. :) |
Date: | 2002-03-26 21:31:16 |
Message-ID: | 001f01c1d50d$91872990$14818b0a@ctcd.cc.tx.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
you need to edit the function pgr_replica_table
and under
spi_exec "alter table ${quotechar}[quote $1]${quotechar} add column pgr_grid int8"
add:
spi_exec "alter table ${quotechar}[quote $1]${quotechar} add constraint pgr_gridnotnull check (pgr_grid notnull)"
This took care of that problem for me :) im using PGSQL 7.2..
hope it works for you..
In reply to:
a.. From: Alvaro Herrera <alvherre(at)atentus(dot)com>
b.. To: PgSQL-General <pgsql-general(at)postgresql(dot)org>
c.. Subject: pgreplicator in 7.2b4
d.. Date: 15 Dec 2001 01:44:02 -0300
Hello:
I'm trying to get pgreplicator running under 7.2b4.
When issuing the "select pgr_replica_table('some_table')", it fails
with:
ERROR: Adding NOT NULL columns is not implemented.
Add the column, then use ALTER TABLE ADD CONSTRAINT.
I tried to make sense of what's doing and ran into this:
DEBUG: query: alter table "prueba" add column pgr_grid int8 not null
Under 7.1, the column is appended to the table without the NOT NULL
constraint, silently ignoring the constraint. Under 7.2 the command is
noted as invalid, as it should be (I wonder why the pgreplicator
developers never noted that the NOT NULL constraint never made into the
table). But it breaks pgreplicator. For now I'm sticking to 7.1.3, but
I'm wondering whether the "right" behaviour is to wait for ALTER TABLE
... NOT NULL to be implemented.
I'm currently trying to hack pgreplicator into issuing the right ALTER
TABLE ADD CONSTRAINT, but cannot find the right way to add a NOT NULL
clause. In CREATE TABLE, NOT NULL is only a column_constraint, and ALTER
TABLE seems to like only table_constraint syntax (or so suggest the \h
command in pqsl and the reference docs). I cannot figure it out, and the
ALTER TABLE reference for 7.2 in Bruce's site doesn't give hints on it.
Also, if adding NOT NULL constraints is not supported by ALTER TABLE ADD
CONTRAINT, I think the error message for ALTER TABLE ADD COLUMN should
not suggest otherwise.
There is a workaround by Joel Burton
(http://techdocs.postgresql.org/techdocs/updatingcolumns.php) by hacking
pg_attribute manually, but the gotchas are dangerous (and anyway, now
that I think of it, what value should one populate the new NOT NULL
column with?).
--
Alvaro Herrera (<alvherre(at)atentus(dot)com>)
Alexis Maldonado
Instructional Technologist
Distance Learning Department
Central Texas College
Phone #: 254- 526-1743
From | Date | Subject | |
---|---|---|---|
Next Message | tsmets | 2002-03-26 21:57:29 | data sets |
Previous Message | Timo Savola | 2002-03-26 21:14:03 | Re: Database/table size |