[Nix-dev] [Hydra] DBIx schemas, case folding, and PostgreSQL 8.4

Ludovic Courtès ludo at gnu.org
Sun Feb 10 22:54:06 CET 2013


Hello,

I hit a case-sensitivity issue with Hydra on PostgreSQL 8.4:

  http://thread.gmane.org/gmane.comp.lang.perl.modules.dbi.general/16888

Normally case-sensitivity isn’t an issue because DBIC doesn’t quote
identifiers.  However, it does quote them when looking for a sequence,
hence the problem above.

The schemas under src/lib/Hydra were generated for an SQLite database
(see src/sql/Makefile.am), which has different case-folding rules from
PostgreSQL (PostgreSQL downcases identifiers and is case-sensitive for
quoted identifiers, whereas SQLite is case-preserving but
case-insensitive, IIUC.)

I tried regenerating the schemas with something like:

  perl -MDBIx::Class::Schema::Loader=make_schema_at,dump_to_dir:../lib -e 'make_schema_at("Hydra::Schema", { naming => "v8", relationships => 1, preserve_case => 1 }, ["dbi:Pg:dbname=hydra;host=localhost;user=hydra"])'

However, that doesn’t preserve CamelCase names.

Thus, as advised on #dbix-class, I ended up doing this:

-__PACKAGE__->table("BuildMachineSystemTypes");
+__PACKAGE__->table(lc("BuildMachineSystemTypes"));

Kinda ugly, but seems to work.

What would a better fix be?

Thanks,
Ludo’.


More information about the nix-dev mailing list