简体   繁体   中英

Is it mandatory to use "" around the table name performing query on PostgreSQL?

I am not so into PostgreSQL<\/strong> and pgAdmin 4<\/strong> and I have the following doubt.

SELECT * FROM public."Example"
ORDER BY id ASC 

The thing that I am not understanding is what is this public name in front of the Example table name. What is it?

As said in postgres documentation: "By default tables (and other objects) are automatically put into a schema named "public". Every new database contains such a schema."

So it means that in PosgreSQL database the "" around the table name are mandatory?

Not really but you need to use it if you are using reserved keywords (such as "user","name"and other)or if your table's name contains uppercase(it's your case) letters. Anyways, in this case if you can it's better change your table's name.

您应该将表名更改为小写字母,然后再试一次

select * from example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM