1

I want to insert data using for example(it works in the tutorial on yt):

INSERT INTO cars (name ,price) 
VALUES ('renault' , '10000')

but it doesn't work in my database and I have no idea why, instead of this I have to use:

INSERT INTO public."cars" VALUES ('renault','10000')

So my question is: What's the difference between public."cars" and just cars?

2
  • In Postgres there is no difference between "cars" and cars. Also what is the error you get when you run the first statement? Edit your question - do not post code or additional information in comments. Commented Nov 3, 2017 at 6:45
  • I've solved my problem, there is some difference between capital letter and lowercase when we create tables and that was my problem, first I've created table "Cars".I didn't realised that column which aren't double-quoted are folded to lower case in PostgreSQL. Commented Nov 3, 2017 at 9:48

1 Answer 1

1

The difference between quoted and unquoted identifiers is that the former allow arbitrary characters and SQL keywords and are not folded to lower case. None of this applies in your case.

The only difference is that in one case you qualify the name with a schema, so perhaps your problem is that there is another table cars on your search_path.

It is impossible to say more, because “does not work” is too unspecific.

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.