postgresql-interfaces/psqlodbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
[postgresql-interfaces/psqlodbc] issue #148: Using text columns from sqlserver
3+ messages / 2 participants
[nested] [flat]

* [postgresql-interfaces/psqlodbc] issue #148: Using text columns from sqlserver
@ 2025-12-10 16:49 "aseques (@aseques)" <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: aseques (@aseques) @ 2025-12-10 16:49 UTC (permalink / raw)
  To: postgresql-interfaces/psqlodbc <[email protected]>

Hi, I am using the ODBC 17.00.0004 to read data from a postgres 17 database from a SQLServer 2022. Everyting works as expected (after setting the search_path to the proper schema) and I can read the data using 

> SELECT * FROM PGDATABASE...issues

The problem is with one of the columns for issues called description that is the type text on the postgres side.


I get this error message

> Msg 7347, Level 16, State 1, Line 1
> OLE DB provider 'MSDASQL' for linked server 'PGDATABASE' returned data that does not match expected data length for column '[PGDATABASE]...[issues].description'. The (maximum) expected data length is 8000, while the returned data length is 12070.


#### Possible fix 1

The most promising solution seems to be to configure the Max LongVarChar value in the ODBC to a value greater than 12070. I tried setting it to 32000 but the message remains the same.
Some references [here](https://portal.microfocus.com/s/article/KM000008035?language=en_US)

#### Possible fix 2

Another solution that's partial would be to truncate the extra elements so the limit i always respected, as explained [here](https://www.postgresql.org/message-id/flat/4854fc01d0c6cb%24fc0c0010%24f4240030%24%40Intuii.com)
```
SELECT 
field1,
field2, ...
CAST(description AS varchar(7900)) AS description,
...
 FROM PGDATABASE...issues
```

#### Questions 

So my question would be: 

- Is this attribute the one I have to modify (I already have marked the Text as LongVarChar)
- Is there anything to be done on the sqlserver side to reload the values for the odbc settings?

Thanks for your help

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [postgresql-interfaces/psqlodbc] issue #148: Using text columns from sqlserver
@ 2025-12-15 10:39 ` "davecramer (@davecramer)" <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: davecramer (@davecramer) @ 2025-12-15 10:39 UTC (permalink / raw)
  To: postgresql-interfaces/psqlodbc <[email protected]>

Sorry, I don't know the answer to this question

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [postgresql-interfaces/psqlodbc] issue #148: Using text columns from sqlserver
@ 2025-12-15 11:19 ` "aseques (@aseques)" <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: aseques (@aseques) @ 2025-12-15 11:19 UTC (permalink / raw)
  To: postgresql-interfaces/psqlodbc <[email protected]>

HI @davecramer it's strange because even when it's not a cryptic error there's not much information on the internet. I'll try to update the issue with more links and information.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2025-12-15 11:19 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-12-10 16:49 [postgresql-interfaces/psqlodbc] issue #148: Using text columns from sqlserver "aseques (@aseques)" <[email protected]>
2025-12-15 10:39 ` "davecramer (@davecramer)" <[email protected]>
2025-12-15 11:19 ` "aseques (@aseques)" <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox