Join the Stack Overflow Community
Stack Overflow is a community of 6.9 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I trying to restore sql dump that looks like this:

COPY table_name (id, oauth_id, foo, bar) FROM stdin;
  1 142 \N  xxxxxxx
  2 142 \N  yyyyyyy
  <dozen similar lines>

last line in this dump: \.

command to restore:

psql < table.sql

or

psql --file=dump.sql

\d+ table_name:

                         Table "public.table_name"
       Column        |         Type          |                                Modifiers                                | Storage  | Stats target | Description
---------------------+-----------------------+-------------------------------------------------------------------------+----------+--------------+-------------
 id                  | integer               | not null default nextval('connected_table_name_id_seq'::regclass)       | plain    |              |
 oauth_id            | integer               | not null                                                                | plain    |              |
 foo                 | character varying     |                                                                         | extended |              |
 bar                 | character varying     |                                                                         | extended |              |

Looks sadly that standard method for backup and rollback does not work :(

Version of the psql: 9.5.4, version of the server: 9.5.2

share|improve this question
1  
Please edit your question and add the create table statements for the table in question – a_horse_with_no_name Dec 28 '16 at 15:34
    
@a_horse_with_no_name added – Vitaly Zdanevich Dec 28 '16 at 15:42
    
@VaoTsun yes, 'ERROR: invalid input syntax for integer' – Vitaly Zdanevich Dec 28 '16 at 15:44
    
Is there a real tab character (ascii: 9) between the column values in the data? – a_horse_with_no_name Dec 28 '16 at 15:47
    
1 142 \N xxxxxxx \N is five columns, and (id, oauth_id, foo, bar) only four – Vao Tsun Dec 28 '16 at 15:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.