Cannot simply use PostgreSQL table name (“relation does not exist”)

后端 未结 11 2645
一向
一向 2020-11-22 05:35

I\'m trying to run the following PHP script to do a simple database query:

$db_host = \"localhost\";
$db_name = \"showfinder\";
$username = \"user\";
$passwo         


        
11条回答
  •  鱼传尺愫
    2020-11-22 06:02

    I had problems with this and this is the story (sad but true) :

    1. If your table name is all lower case like : accounts you can use: select * from AcCounTs and it will work fine

    2. If your table name is all lower case like : accounts The following will fail: select * from "AcCounTs"

    3. If your table name is mixed case like : Accounts The following will fail: select * from accounts

    4. If your table name is mixed case like : Accounts The following will work OK: select * from "Accounts"

    I dont like remembering useless stuff like this but you have to ;)

提交回复
热议问题