diff --git a/dialects/postgres.go b/dialects/postgres.go index 6e379583..df262614 100644 --- a/dialects/postgres.go +++ b/dialects/postgres.go @@ -1145,7 +1145,11 @@ WHERE n.nspname= s.table_schema AND c.relkind = 'r' AND c.relname = $1%s AND f.a } if colDefault != nil && *colDefault == "unique_rowid()" { // ignore the system column added by cockroach - continue + if colName == "rowid" { // but only skip if the name is also rowid therefore allowing custom primary keys columns and don't recreate tables defined with with pk autoincr + continue + } + te := "" + colDefault = &te } col.Name = strings.Trim(colName, `" `)