Message-ID: From: "Hunaid2000 (@Hunaid2000)" To: "postgresql-interfaces/psqlodbc" Date: Sat, 05 Oct 2024 10:10:20 +0000 Subject: Re: [postgresql-interfaces/psqlodbc] issue #51: SQL_DESC_OCTET_LENGTH regression test difference In-Reply-To: References: List-Id: X-GitHub-Author-Login: Hunaid2000 X-GitHub-Comment-Id: 2395006277 X-GitHub-Comment-Type: issue_comment X-GitHub-Edited-At: 2024-10-05T10:13:01Z X-GitHub-Issue: 51 X-GitHub-Repo: postgresql-interfaces/psqlodbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/postgresql-interfaces/psqlodbc/issues/51#issuecomment-2395006277 Content-Type: text/plain; charset=utf-8 It basically depends on client encoding, I guess. I get 20 on Windows and 40 on Ubuntu. The length is set in `pgtype_attr_buffer_length` function. https://github.com/postgresql-interfaces/psqlodbc/blob/59728b929b54b3b230aead909895483b5b2f35a1/pgtypes.c#L1098-L1118 It depends on `coef = conn->mb_maxbyte_per_char;` which is set on the line `629` in this block. https://github.com/postgresql-interfaces/psqlodbc/blob/59728b929b54b3b230aead909895483b5b2f35a1/connection.c#L615-L632 In case of Ubuntu: ``` postgres=# show client_encoding; client_encoding ----------------- UTF8 (1 row) ``` https://github.com/postgresql-interfaces/psqlodbc/blob/59728b929b54b3b230aead909895483b5b2f35a1/multibyte.c#L211-L236 which maps to 4 here: `pg_mb_maxlen(self->ccsc);`. As a result, we get 10 * 4 = 40. For Windows, I believe its just `prec * WCLEN` so 10 * 2 = 20. @df7cb In your case, I guess `pg_mb_maxlen` returns 1.