From: | Dave Page <dpage(at)postgresql(dot)org> |
---|---|
To: | luiz <luiz(at)planit(dot)com(dot)br> |
Cc: | pgadmin-support(at)postgresql(dot)org |
Subject: | Re: ALTER TABLE ALTER COLUMN in view |
Date: | 2007-05-09 14:25:23 |
Message-ID: | 4641D9D3.3060703@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgadmin-support |
luiz wrote:
> 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 ?
Done. Will be in 1.8.0.
Thanks for the suggestions.
Regards, Dave.
From | Date | Subject | |
---|---|---|---|
Next Message | Laurent ROCHE | 2007-05-09 17:28:56 | PG Admin talks to me ... at last ! |
Previous Message | Taras Kopets | 2007-05-09 13:53:09 | Open file in Query tool from command line |