Re: ALTER TABLE ALTER COLUMN in view - Mailing list pgadmin-support

From Dave Page
Subject Re: ALTER TABLE ALTER COLUMN in view
Date
Msg-id 4641D9D3.3060703@postgresql.org
Whole thread Raw
In response to ALTER TABLE ALTER COLUMN in view  ("luiz" <luiz@planit.com.br>)
List 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.


pgadmin-support by date:

Previous
From: "Taras Kopets"
Date:
Subject: Open file in Query tool from command line
Next
From: Laurent ROCHE
Date:
Subject: PG Admin talks to me ... at last !