Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a terrible diff issue case of PostgreSQL #91

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions lib/SQL/Translator/Parser/DBI/PostgreSQL.pm
Expand Up @@ -37,17 +37,16 @@ sub parse {
my $schema = $tr->schema;

my $column_select = $dbh->prepare(
"SELECT a.attname, case
"SELECT a.attname, case
when t.oid = any ('{int,int8,int2}'::regtype[])
and ad.adsrc = 'nextval('''
|| (pg_get_serial_sequence (a.attrelid::regclass::text
, a.attname))::regclass
|| (pg_get_serial_sequence (a.attrelid::regclass::text, a.attname))::regclass
|| '''::regclass)'
then case t.oid
when 'int8'::regtype then 'bigserial'
when 'int'::regtype then 'serial'
when 'int2'::regtype then 'smallserial'
end
end
else format_type(t.oid, a.atttypmod)
end as typname, a.attnum,
case typname
Expand Down
2 changes: 0 additions & 2 deletions lib/SQL/Translator/Producer/PostgreSQL.pm
Expand Up @@ -704,7 +704,6 @@ sub convert_datatype
$data_type =~ s/\([0-9]+\)$//; # Bug fix for type(size)(size)
$data_type .= '(' . join( ',', @size ) . ')';
}

if($array)
{
$data_type .= '[]';
Expand Down Expand Up @@ -782,7 +781,6 @@ sub alter_field
$to_field->name),
$to_dt eq 'serial' ? 'integer' : "$1int"
);

my $seq_name = "${table_name}_${field_name}_seq";
my $by_name = "${table_name}.${field_name}";
my @args = map(
Expand Down
2 changes: 1 addition & 1 deletion t/46xml-to-pg.t
Expand Up @@ -45,7 +45,7 @@ CREATE TABLE "Basic" (
-- Hello emptytagdef
"emptytagdef" character varying DEFAULT '',
"another_id" integer DEFAULT 2,
"timest" timestamp,
"timest" timestamp without time zone,
PRIMARY KEY ("id"),
CONSTRAINT "emailuniqueindex" UNIQUE ("email"),
CONSTRAINT "very_long_index_name_on_title_field_which_should_be_truncated_for_various_rdbms" UNIQUE ("title")
Expand Down