4 my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_PG_${_}" } qw/DSN USER PASS/};
6 #warn "$dsn $user $pass";
8 plan skip_all, 'Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test'
9 . ' (note: creates and drops a table named artist!)' unless ($dsn && $user);
13 DBICTest::Schema->compose_connection('PgTest' => $dsn, $user, $pass);
15 my $dbh = PgTest->schema->storage->dbh;
17 $dbh->do("CREATE TABLE artist (artistid serial PRIMARY KEY, name VARCHAR(255), charfield CHAR(10));");
19 PgTest::Artist->load_components('PK::Auto::Pg');
21 my $new = PgTest::Artist->create({ name => 'foo' });
23 is($new->artistid, 1, "Auto-PK worked");
25 $new = PgTest::Artist->create({ name => 'bar' });
27 is($new->artistid, 2, "Auto-PK worked");
29 my $test_type_info = {
31 'data_type' => 'integer',
36 'data_type' => 'character varying',
41 'data_type' => 'character',
47 my $type_info = PgTest->schema->storage->columns_info_for('artist');
48 is_deeply($type_info, $test_type_info, 'columns_info_for - column data types');
50 $dbh->do("DROP TABLE artist;");