From 599b5967bc018d8381cc8601a4f1e680cdbdd376 Mon Sep 17 00:00:00 2001 From: calledit <1573053+calledit@users.noreply.github.com> Date: Sun, 9 Apr 2023 14:12:39 +0200 Subject: [PATCH 1/3] Adding TableOID and AtribNrto fieldDesc struct --- rows.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rows.go b/rows.go index c6aa5b9a3..dd5e5dd93 100644 --- a/rows.go +++ b/rows.go @@ -11,8 +11,16 @@ import ( const headerSize = 4 type fieldDesc struct { + + //If the field can be identified as a column of a specific table, the object ID of the table; otherwise zero. + TableOID oid.Oid + + //If the field can be identified as a column of a specific table, the attribute number of the column; otherwise zero. + AtribNr int + // The object ID of the data type. OID oid.Oid + // The data type size (see pg_type.typlen). // Note that negative values denote variable-width types. Len int From 7d525900a11dfbc6d24d4a880284382cf25fc2a4 Mon Sep 17 00:00:00 2001 From: calledit <1573053+calledit@users.noreply.github.com> Date: Sun, 9 Apr 2023 14:18:26 +0200 Subject: [PATCH 2/3] Add parsing for TableOID and AtribNr --- conn.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/conn.go b/conn.go index c47a8b3a4..9fa315b4b 100644 --- a/conn.go +++ b/conn.go @@ -1955,7 +1955,8 @@ func parseStatementRowDescribe(r *readBuf) (colNames []string, colTyps []fieldDe colTyps = make([]fieldDesc, n) for i := range colNames { colNames[i] = r.string() - r.next(6) + colTyps[i].TableOID = r.oid() + colTyps[i].AtribNr = r.int16() colTyps[i].OID = r.oid() colTyps[i].Len = r.int16() colTyps[i].Mod = r.int32() @@ -1972,7 +1973,8 @@ func parsePortalRowDescribe(r *readBuf) rowsHeader { colTyps := make([]fieldDesc, n) for i := range colNames { colNames[i] = r.string() - r.next(6) + colTyps[i].TableOID = r.oid() + colTyps[i].AtribNr = r.int16() colTyps[i].OID = r.oid() colTyps[i].Len = r.int16() colTyps[i].Mod = r.int32() From 10662faa9450cb931df55090b7cb8c9e0c380284 Mon Sep 17 00:00:00 2001 From: calledit <1573053+calledit@users.noreply.github.com> Date: Tue, 5 Mar 2024 17:25:01 +0100 Subject: [PATCH 3/3] added spaces as requested in review --- rows.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rows.go b/rows.go index dd5e5dd93..86e542c8d 100644 --- a/rows.go +++ b/rows.go @@ -12,10 +12,10 @@ const headerSize = 4 type fieldDesc struct { - //If the field can be identified as a column of a specific table, the object ID of the table; otherwise zero. + // If the field can be identified as a column of a specific table, the object ID of the table; otherwise zero. TableOID oid.Oid - //If the field can be identified as a column of a specific table, the attribute number of the column; otherwise zero. + // If the field can be identified as a column of a specific table, the attribute number of the column; otherwise zero. AtribNr int // The object ID of the data type.