0

I am trying to insert a table specific sql dump into a database (psql). There is a table called "templates" which already has some values, and trying to dump new values. The sql file looks like below.

INSERT INTO templates (id, name, created_at, updated_at, template_path, page_type, container_type, entity_type, entity_id, asset_group_id, data_proxy_id, publisher_id, status, default, image_url_path, sequence) VALUES ('434', 'Full Width Image', '2018-10-25 11:13:35.695256', '2018-11-23 07:26:25.663427', '/templates/full_width_landscape', null, null, null, null, null, null, '655', 'true', 'true', 'template1', 1);

When I am trying to insert this sql file by doing

\i sql file path

I am getting the following error:

ERROR:  syntax error at or near "default"
LINE 1: ...et_group_id, data_proxy_id, publisher_id, status, default, i...

Can someone tell what's wrong here ?

2
  • 2
    default is a reserved word in SQL. Use "default" instead, i.e. a delimited identifier. Commented Nov 23, 2018 at 9:58
  • 1
    default is a reserved word in SQL. Use a different name, so you don't have conflicts with reserved words. Commented Nov 23, 2018 at 12:27

1 Answer 1

1

you have use use double quote for reserve word as a column name

    INSERT INTO templates (id, name, created_at, updated_at,
 template_path, page_type, container_type,
 entity_type, entity_id, asset_group_id, 
data_proxy_id, publisher_id, status, "default", 
image_url_path, sequence) VALUES ('434', 'Full Width Image', '2018-10-25 11:13:35.695256', '2018-11-23 07:26:25.663427', '/templates/full_width_landscape', null, null, null, null, null, null, '655', 'true', 'true', 'template1', 1);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.