IgnoreMessageParameters is used to ignore certain fields within a backend message, as they may not yet be implemented and therefore will return incorrect results (or variable results, such as with non-stable OIDs).
(message pgproto3.BackendMessage)
| 7439 | // IgnoreMessageParameters is used to ignore certain fields within a backend message, as they may not yet be implemented |
| 7440 | // and therefore will return incorrect results (or variable results, such as with non-stable OIDs). |
| 7441 | func IgnoreMessageParameters(message pgproto3.BackendMessage) pgproto3.BackendMessage { |
| 7442 | switch message := message.(type) { |
| 7443 | case *pgproto3.RowDescription: |
| 7444 | for i := range message.Fields { |
| 7445 | message.Fields[i].TableOID = 0 |
| 7446 | // User-defined types will have an OID outside the reserved range, so we set those to zero |
| 7447 | if message.Fields[i].DataTypeOID > 16383 { |
| 7448 | message.Fields[i].DataTypeOID = 0 |
| 7449 | } |
| 7450 | } |
| 7451 | return message |
| 7452 | default: |
| 7453 | return message |
| 7454 | } |
| 7455 | } |
| 7456 | |
| 7457 | // WireScriptTest is used to test wire messages, ensuring that our wire protocol behaves as expected. |
| 7458 | type WireScriptTest struct { |