Skip to content

Rose::DB::Object::Loader->make_classes method fails on Postresql 9.6 #21

Description

@JimBiardCics

I'm using Rose::DB with Postgresql 9.6. The call to ROSE::DB::Object::Loader->make_classes method fails to create any classes. I've traced it down, and found that the problem is in the line

unless($db->has_primary_key($table))

The call to $db->has_primary_key($table) returns false because no catalog was specified in the arguments to the call. If you call this method separately with a catalog argument that specifies the correct catalog the call returns true.

The failure is due to the way the Rose::DB->_get_primary_key_column_names method (which is ultimately called by has_primary_key) is written. The test below

next PK unless($pk_info->{'TABLE_CAT'} eq $catalog &&

will always fail if a catalog was not specified in the arguments. The Rose::DB Postgresql classes are set up so as to prevent specification of a catalog, so there is no way to specify a catalog other than passing it as an argument. Since the line in Loader->make_classes doesn't pass the catalog as an argument, all classes report that they have no primary key. Loader->make_classes skips classes that don't have a primary key.

This problem propagates down into the Rose::DB::Object::Metadata->auto_initialize method which is also called by Loader->make_classes. Even if I remove the test for catalog from the Rose::DB->_get_primary_key_column_names method, the Metadata->auto_initialize method fails.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions