0

I am using PostgreSQL using unixodbc driver, and while trying to get connection, I get error. I am only printing the value of pfNativeError of SQLError, and I get a value of '26'.

I have gone through the error codes returned by postgresql, as listed here: http://www.postgresql.org/docs/8.1/static/errcodes-appendix.html#ERRCODES-TABLE

I wanted to know if unixodbc returns in pfNativeError just the last three characters of the error codes mentioned in link above? If that is true, I assume the only possibility is for the following error code:

22026 STRING DATA LENGTH MISMATCH string_data_length_mismatch

Do let me know if I am thinking in right direction. Also, this issue I've noticed only when the PostgreSQL has millions of rows, and the query which results in connection failure is trying to fetch a lot of data (10Ks). Can someone give any idea to why the problem might be happening?

EDIT 1:

If its of any help, I'm getting following values for szErrorMsg:

  • Error while executing the query
  • Could not send Query(connection dead)

EDIT 2:

'26' returned is in INTEGER, and the codes mentioned in link above are in HEX. 26 in decimal corresponds to 1A in hex. Unfortunately, it does not correspond to any thing in the above mentioned documentation. Clearly I am out of ideas! Can someone tell me what different pfNativeError codes correspond to?

user3098199
  • 31
  • 1
  • 5
  • Any particular reason you're using the documentation for PostgreSQL 8.1? Also, why not get the full `SQLSTATE`? – Craig Ringer Apr 09 '14 at 12:13
  • @CraigRinger: No specific reason, I guess the error codes would not change a lot. Another mistake I realised is that the retured code of '26' is in integer, where as the ones mentioned in the postgres doc is in HEX. So 26 corresponds to 1A, which is not present at all! I am clearly clueless. I have no clue why I didn't get full szSqlState, would it give me the complete error code as mentioned in the link? Can you at least tell me if there is any way to find what '26' in pfNativeError corresponds to? – user3098199 Apr 09 '14 at 12:28
  • `SQLSTATE` is a 5-character *text* code. It is not hex. You need to use the `SQLSTATE`. No idea what `pgNativeError` means, but I suspect it's the wrong tree to be barking up. – Craig Ringer Apr 09 '14 at 12:32
  • So you mean printing szSqlError is my best bet to debug the issue? And I cam across the link: http://www.rosam.se/doc/atsdoc/Server%20-%20Messages%20and%20Codes/ADC5906BBD514757BAEE546DC6F7A4FA/0.htm It is probably for some specific DB, but can I say the same error code would apply in my case also? For 26, it says: 26 - Unable to allocate storage for conditions when no index was selected . What do you think? – user3098199 Apr 09 '14 at 13:07

0 Answers0