Thread: Reverse engineered Column definition incorrect for DEFAULT

Reverse engineered Column definition incorrect for DEFAULT

From
"Donald Fraser"
Date:
The reverse engineered code for column definitions if incorrect for DEFAULT values.
I create table such as:
 
REATE TABLE public.tbl_bkgndata
(
  id int4 NOT NULL DEFAULT nextval('tbl_bkgndata_id_seq'::text),
) WITHOUT OIDS;
 
Reverse engineered column definition is:
 
ALTER TABLE public.tbl_bkgndata ADD COLUMN id int4;
ALTER TABLE public.tbl_bkgndata ALTER COLUMN id SET STORAGE PLAIN;
ALTER TABLE public.tbl_bkgndata ALTER COLUMN id SET NOT NULL;
ALTER TABLE public.tbl_bkgndata ALTER COLUMN id DEFAULT nextval('tbl_bkgndata_id_seq'::text);
 
Last row should read:
ALTER TABLE public.tbl_bkgndata ALTER COLUMN id SET DEFAULT nextval('tbl_bkgndata_id_seq'::text);
 
That is the key word SET is missing.
 
Regards
Donald Fraser.

Re: Reverse engineered Column definition incorrect for DEFAULT

From
"Hiroshi Saito"
Date:
Dear Donald.

Thank you very much.
It will be reflected soon.

Dave Apply it?

----- Original Message -----
From: Donald Fraser

> The reverse engineered code for column definitions if incorrect for DEFAULT values.
> I create table such as:

(snip)
> ALTER TABLE public.tbl_bkgndata ALTER COLUMN id DEFAULT nextval('tbl_bkgndata_id_seq'::text);
>
> Last row should read:
> ALTER TABLE public.tbl_bkgndata ALTER COLUMN id SET DEFAULT nextval('tbl_bkgndata_id_seq'::text);
>
> That is the key word SET is missing.

Re: Reverse engineered Column definition incorrect

From
Andreas Pflug
Date:
Donald Fraser wrote:

> The reverse engineered code for column definitions if incorrect for 
> DEFAULT values.
> I create table such as:
>  
> REATE TABLE public.tbl_bkgndata
> (
>   id int4 NOT NULL DEFAULT nextval('tbl_bkgndata_id_seq'::text),
> ) WITHOUT OIDS;
>  
> Reverse engineered column definition is:
>  
> ALTER TABLE public.tbl_bkgndata ADD COLUMN id int4;
> ALTER TABLE public.tbl_bkgndata ALTER COLUMN id SET STORAGE PLAIN;
> ALTER TABLE public.tbl_bkgndata ALTER COLUMN id SET NOT NULL;
> ALTER TABLE public.tbl_bkgndata ALTER COLUMN id DEFAULT 
> nextval('tbl_bkgndata_id_seq'::text);
>  
> Last row should read:
> ALTER TABLE public.tbl_bkgndata ALTER COLUMN id SET DEFAULT 
> nextval('tbl_bkgndata_id_seq'::text);
>  
> That is the key word SET is missing.


Fixed in cvs, thanks for reporting.

Regards,
Andreas