开发者

Why does PostgreSQL have to be different (scheme does not exist)?

开发者 https://www.devze.com 2023-01-03 03:51 出处:网络
I\'m not used to working with PostgreSQL, but am using Zend_Db_Select to create my queries. What does the error below mean?

I'm not used to working with PostgreSQL, but am using Zend_Db_Select to create my queries. What does the error below mean?

SQL error:
ERROR:  schema "il" does not exist

In statement:
SE开发者_如何学运维LECT il.count(*) AS "count" FROM "image_lite" AS "il" 
INNER JOIN "exif_parse" AS "ex" ON il.image_id = ex.image_id 
WHERE (ex.cam_make = 'apple')


It's parsing il.count(*) as a call to a function "count" in the schema "il". Probably what you want is the expression:

count(il.*)


You can think of schema in PostgreSQL as you would a database in MySQL. Also try removing the double quotes around everything because that's just plain strange and might be causing the problem.

Oh I see il.count(*) make no sense at all.

Just do this instead:

select count(*) cnt       
  from image_lite il 
  join exif_parse ex on il.image_id = ex.image_id 
 where ex.cam_make = 'apple'


Postgres is interpreting the "il" in "il.count(*)" as a schema name. You can simply omit it and ask for count(*), or if you want to get specific, count(il.*)

If you're coming from MySQL, schemas are what the rest of the world calls what MySQL calls a database.

0

精彩评论

暂无评论...
验证码 换一张
取 消