Re: Null option and Default value Lost when use CREATE TABLE AS to backup a table. - Mailing list pgsql-bugs

From Vik Fearing
Subject Re: Null option and Default value Lost when use CREATE TABLE AS to backup a table.
Date
Msg-id eb300c73-9f98-d243-c762-88e47d88c2d6@postgresfriends.org
Whole thread Raw
In response to Null option and Default value Lost when use CREATE TABLE AS to backup a table.  ("Xiao, Bing (Benny)" <bing.xiao@dxc.com>)
List pgsql-bugs
On 10/21/21 7:47 AM, Xiao, Bing (Benny) wrote:
>
>   1.  Create back up table.
> 
>                create table contact_bckp as table contacts with data;

This is not the correct way to do this.  Do it this way instead:

BEGIN;
CREATE TABLE contact_bckp (LIKE contacts INCLUDING ALL);
INSERT INTO contact_bckp TABLE contacts;
COMMIT;
-- 
Vik Fearing



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17240: at time zone ... ; wrong result
Next
From: Francisco Olarte
Date:
Subject: Re: Null option and Default value Lost when use CREATE TABLE AS to backup a table.