Skip to content

Commit e731fd0

Browse files
committed
fix: wrong ENUM column type detection, due to less strict regex
Refs #2460
1 parent 89ccbac commit e731fd0

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

source/dbconnection.pas

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2215,6 +2215,8 @@ function TDBConnection.GetDatatypeByName(var DataType: String; DeleteFromSource:
22152215
rx := TRegExpr.Create;
22162216
rx.ModifierI := True;
22172217
MatchLen := 0;
2218+
// Remove quotes around PG enums: "UserStatus"
2219+
DataType := DeQuoteIdent(DataType);
22182220
for i:=0 to High(FDatatypes) do begin
22192221
Types := FDatatypes[i].Name;
22202222
if FDatatypes[i].Names <> '' then begin
@@ -2226,7 +2228,7 @@ function TDBConnection.GetDatatypeByName(var DataType: String; DeleteFromSource:
22262228
TypesSorted.Free;
22272229
end;
22282230

2229-
rx.Expression := '\b('+Types+')\b(\[\])?';
2231+
rx.Expression := '^('+Types+')\b(\[\])?';
22302232
Match := rx.Exec(DataType);
22312233
// Prefer a later match which is longer than the one found before.
22322234
// See http://www.heidisql.com/forum.php?t=17061

0 commit comments

Comments
 (0)