Subject: | Can't build schema with pg 8.4.2 |
Tables referencing another table named after a reserved word appear to
be broken. Yes, it was a schema mistake I'm correcting, but here's how
I can replicate this on PG 8.4.2. Here's the SQL:
CREATE TABLE character (
id SERIAL PRIMARY KEY,
name VARCHAR(100) NOT NULL UNIQUE
);
CREATE TABLE foo (
id SERIAL PRIMARY KEY,
character_id INTEGER NOT NULL,
FOREIGN KEY (character_id) REFERENCES character(id)
);
Here's the code:
use DBIx::Class::Schema::Loader qw/ make_schema_at /;
make_schema_at(
'My::Schema',
{
debug => 1,
dump_directory => './testlib',
},
[ 'dbi:Pg:dbname="foo"', 'bar', 'baz' ],
);
Here's the output:
Bad table or view 'public.foo', ignoring:
DBIx::Class::Schema::Loader::make_schema_at(): DBI Exception:
DBD::Pg::st execute failed: ERROR: cross-database references are not
implemented: "public.public.foo"
LINE 1: SELECT * FROM public.public.foo WHERE ( 1 = 0 )
^ [for Statement "SELECT * FROM public.public.foo WHERE
( 1 = 0 )"] at testloader5.pl line 4
#!/usr/bin/env perl
My::Schema::Result::Character->table("character");
My::Schema::Result::Character->add_columns(
"id",
{
data_type => "integer",
default_value => "nextval('character_id_seq'::regclass)",
is_auto_increment => 1,
is_nullable => 0,
},
"name",
{
data_type => "character varying",
default_value => undef,
is_nullable => 0,
size => 100,
},
);
My::Schema::Result::Character->set_primary_key("id");
My::Schema::Result::Character-
Show quoted text
>add_unique_constraint("character_name_key", ["name"]);
Dumping manual schema for My::Schema to directory ./testlib ...
Schema dump completed.
Cheers,
Ovid