[odb-users] ask a question

Boris Kolpackov boris at codesynthesis.com
Thu Sep 12 05:06:42 EDT 2013


wanghuisoftware at 126.com writes:

> if i use "#pragma db view(SPSDAO::SpsIndividual) table("v_Individuals") 
> readonly"
> it generate error "[Error: Relations "v_Individuals" does not exist]", but
> it actually existed.

I am guessing you are using PostgreSQL and this is most likely a
capitalization issue. When you create a view like this:

CREATE VIEW v_Individuals ...

The actual view created is called v_individuals. At the same time, ODB
always quotes all the database identifiers so the SELECT statement issued
for your view will be:

SELECT ... FROM "v_Individuals" ...

As a result, you either need to quote the name when creating the view:

CREATE VIEW "v_Individuals" ...

Or use the lower-case name in the pragma:

#pragma db view(SPSDAO::SpsIndividual) table("v_individuals")


More information about the odb-users mailing list