6

My table has three columns, but I'm only using one for most rows.

I'm trying to do a basic insert in PSQL, like so:

grouper=> INSERT INTO master_list VALUES ('Ebay',,);

But I'm getting a syntax error:

ERROR:  syntax error at or near ","
LINE 1: INSERT INTO master_list VALUES ('Ebay',,);
                                               ^

Any advice or suggestions welcome!

2
  • Yes. List the columns in the insert statement. Then you don't have to worry about empty values. Commented Jan 22, 2014 at 23:12
  • INSERT INTO lsa_loan_details (loan_number, repayment_type ) VALUES ('123456789',''); Say I want to insert EMPTY for repayment_type character varying(100), you can also specify two single quotes without space. it worked for me! Commented Jan 21, 2020 at 13:53

1 Answer 1

13

Try

INSERT INTO master_list VALUES ('Ebay',null,null);

or

INSERT INTO master_list (fieldname) VALUES ('Ebay');
Sign up to request clarification or add additional context in comments.

1 Comment

huh, I'm surprised that a empty comma delimited field wouldn't be considered null automatically... this did work though, thanks!

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.