Hello,
when reading indexnames from "pg_indexes", they are cut to 32 characters. Regarding the PostgreSQL-documenation, the type of this column is "name" which is 64 Byte.
What I found : the function "TZPostgreSQLResultSet.DefinePostgreSQLToSQLType" gives a precision of 32, which is used to truncate the resulting string (I use still Zeos 6.5.1, but also in 7.0.0 the value is 32).
Why this difference ?
Regards
Andreas
Indexnames
Moderators: gto, cipto_kh, EgonHugeist, olehs
Thank, you're right.
So, I changed the function
procedure TZPostgreSQLResultSet.DefinePostgreSQLToSQLType(ColumnIndex: Integer;
ColumnInfo: TZColumnInfo; TypeOid: Oid);
var
SQLType: TZSQLType;
Connection: IZPostgreSQLConnection;
begin
Connection := Statement.GetConnection as IZPostgreSQLConnection;
case TypeOid of
790: ColumnInfo.Currency := True; { money }
19: if ((Connection.GetServerMajorVersion = 7) and (Connection.GetServerMinorVersion < 3)) then ColumnInfo.Precision := 32
else ColumnInfo.Precision := 64; { name }
1186: ColumnInfo.Precision := 32; { interval }
24: ColumnInfo.Precision := 10; { regproc }
17:{ bytea }
if Connection.IsOidAsBlob then
ColumnInfo.Precision := 256;
end;
SQLType := PostgreSQLToSQLType(Connection, TypeOid);
if Connection.GetCharactersetCode = csUTF8 then
case SQLType of
stString: SQLType := stUnicodeString;
stAsciiStream: SQLType := stUnicodeStream;
end;
if SQLType <> stUnknown then
ColumnInfo.ColumnType := SQLType
else
begin
ColumnInfo.ColumnType := stString;
ColumnInfo.Precision := 255;
ColumnInfo.ReadOnly := True;
end;
end;
All the test works fine, so in a short time this change will be added to the
SVN trunk
Thank you
So, I changed the function
procedure TZPostgreSQLResultSet.DefinePostgreSQLToSQLType(ColumnIndex: Integer;
ColumnInfo: TZColumnInfo; TypeOid: Oid);
var
SQLType: TZSQLType;
Connection: IZPostgreSQLConnection;
begin
Connection := Statement.GetConnection as IZPostgreSQLConnection;
case TypeOid of
790: ColumnInfo.Currency := True; { money }
19: if ((Connection.GetServerMajorVersion = 7) and (Connection.GetServerMinorVersion < 3)) then ColumnInfo.Precision := 32
else ColumnInfo.Precision := 64; { name }
1186: ColumnInfo.Precision := 32; { interval }
24: ColumnInfo.Precision := 10; { regproc }
17:{ bytea }
if Connection.IsOidAsBlob then
ColumnInfo.Precision := 256;
end;
SQLType := PostgreSQLToSQLType(Connection, TypeOid);
if Connection.GetCharactersetCode = csUTF8 then
case SQLType of
stString: SQLType := stUnicodeString;
stAsciiStream: SQLType := stUnicodeStream;
end;
if SQLType <> stUnknown then
ColumnInfo.ColumnType := SQLType
else
begin
ColumnInfo.ColumnType := stString;
ColumnInfo.Precision := 255;
ColumnInfo.ReadOnly := True;
end;
end;
All the test works fine, so in a short time this change will be added to the
SVN trunk
Thank you