ALTER TABLE ALTER COLUMN in view

From: "luiz" <luiz(at)planit(dot)com(dot)br>
To: pgadmin-support(at)postgresql(dot)org
Subject: ALTER TABLE ALTER COLUMN in view
Date: 2007-05-08 14:33:02
Message-ID: 20070508135844.M70431@planit.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

Hi all,

I have a scenario like follow (script generated with pg_dump) :

CREATE TABLE teste (
id integer NOT NULL,
ds character varying(20),
n2 character varying(10)
);

CREATE SEQUENCE teste_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;

ALTER TABLE teste ALTER COLUMN id SET DEFAULT nextval('teste_id_seq'::regclass);

ALTER TABLE ONLY teste
ADD CONSTRAINT pk_teste PRIMARY KEY (id);

ALTER SEQUENCE teste_id_seq OWNED BY teste.id;

CREATE VIEW vteste AS
SELECT teste.id, teste.ds, teste.n2 FROM teste;

ALTER TABLE vteste ALTER COLUMN id SET DEFAULT nextval('teste_id_seq'::regclass);

Well this last line make a change on a view column and it works.
I do it because when inserting a row in the view vteste, I got a message error
like "teste.id does not accept NULL values"

Searching in the internet, I found a message where Tom Lane suggest to do this.
Well, I don´t found anything in Postgresql manual saying that we can do it in
views, but I don´t found anything saying that we don´t must do it too.
Since pg_dump generates the script with this definition, I think that they
must be supported by PostgreSQL

The only thing that I have a objection is because this don´t appear in pgadmin
views definition. And we don´t mind that this "ALTER COLUMN" exists in the
Database structure.

I want to request/suggest that views script generates a complete script in the
sqlpane like when select a table (with index,triggers creation sql scripts) or
with at least this DDL, since we can´t see it anywhere.

May we have a icon for this alter columns in the view definition tree too ?

I´m using pgAdmin 1.6.3 in a winXP pro SP2 with Postgresql 8.2.4

Thanks in Advance

Luiz

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Kopets Taras 2007-05-08 18:52:56 Recent Files menu item and Searching in Query tool
Previous Message Dave Page 2007-05-08 08:36:06 Re: tutorial for starting development