Questions tagged «quoted-identifier»

10
不能简单地使用PostgreSQL表名(“关系不存在”)
我正在尝试运行以下PHP脚本来执行简单的数据库查询: $db_host = "localhost"; $db_name = "showfinder"; $username = "user"; $password = "password"; $dbconn = pg_connect("host=$db_host dbname=$db_name user=$username password=$password") or die('Could not connect: ' . pg_last_error()); $query = 'SELECT * FROM sf_bands LIMIT 10'; $result = pg_query($query) or die('Query failed: ' . pg_last_error()); 这将产生以下错误: 查询失败:错误:关系“ sf_bands”不存在 在所有示例中,我都能找到有人指出该关系不存在的错误,这是因为他们在表名中使用大写字母。我的表格名称没有大写字母。有没有一种方法可以查询我的表而不包含数据库名称,即showfinder.sf_bands?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.