[odb-users] PostgreSQL 42P01 error

Сергей Никонов shprotello at mail.ru
Wed Jun 13 11:49:50 EDT 2018


Hello everybody,

I encountered a curious problem with PostgreSQL error 42P01. My database schema is completely generated by ODB C++ schema code.
When I try to execute a view query generated by ODB I get the following error: ""errorMessage": "42P01: ERROR:  relation \"config_item_attribute_shape\" does not exist\nLINE 1: ...on\", \"s_config_item_attribute\".\"description\" FROM \"config_it...\n". At the same time the query works in PostgreSQL Admin panel 4. This issue is actually a "show stopper" in my project.

PREPARE SELECT DISTINCT "i"."id_code", "i"."id_customization", "i"."type", "i"."description", "s_config_item_attribute_shape"."kind", "s_config_item_attribute"."id", "s_config_item_attribute"."typeid", "s_config_item_attribute"."owner_code", "s_config_item_attribute"."owner_customization", "s_config_item_attribute"."description" FROM "config_item_attribute_shape" AS "s_config_item_attribute_shape" LEFT JOIN "config_item_attribute" AS "s_config_item_attribute" ON "s_config_item_attribute"."id"="s_config_item_attribute_shape"."id" LEFT JOIN "config_item" AS "i" ON "s_config_item_attribute"."owner_code"="i"."id_code" AND "s_config_item_attribute"."owner_customization"="i"."id_customization" WHERE ("s_config_item_attribute_shape"."id" IS NOT NULL) AND ("i"."id_code" LIKE $1)

{
    "errorCode": "ODB",
    "errorMessage": "42P01: ERROR:  relation \"config_item_attribute_shape\" does not exist\nLINE 1: ...on\", \"s_config_item_attribute\".\"description\" FROM \"config_it...\n                                                             ^",
}

This is the definition of the view:
#pragma db view object(item_attribute_shape = s) \
                object(item = i : s::m_owner) \
                query(s::m_id.is_not_null() && (?), distinct)
    struct shaped_items
    {
      std::shared_ptr<item> i;
      std::shared_ptr<item_attribute_shape> s;
    };

item_attribute_shape class is derived from abstract polymorhic item_attribute one.

Environment: MSVS 2013, ODB 2.5.0-b.3.


More information about the odb-users mailing list