Skip to content

Commit 02dfeeb

Browse files
committed
fix: wrong ENUM column type detection, due to less strict regex
Closes #2460
1 parent f1e4485 commit 02dfeeb

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
@@ -2296,6 +2296,8 @@ function TDBConnection.GetDatatypeByName(var DataType: String; DeleteFromSource:
22962296
rx := TRegExpr.Create;
22972297
rx.ModifierI := True;
22982298
MatchLen := 0;
2299+
// Remove quotes around PG enums: "UserStatus"
2300+
DataType := DeQuoteIdent(DataType);
22992301
for i:=0 to High(FDatatypes) do begin
23002302
Types := FDatatypes[i].Name;
23012303
if FDatatypes[i].Names <> '' then begin
@@ -2307,7 +2309,7 @@ function TDBConnection.GetDatatypeByName(var DataType: String; DeleteFromSource:
23072309
TypesSorted.Free;
23082310
end;
23092311

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

0 commit comments

Comments
 (0)