Re: Bug: attributes dynamically filled (e.g. xml) truncated - Mailing list pgsql-odbc

From Heikki Linnakangas
Subject Re: Bug: attributes dynamically filled (e.g. xml) truncated
Date
Msg-id 5147130A.7090802@vmware.com
Whole thread Raw
In response to Bug: attributes dynamically filled (e.g. xml) truncated  (Ben Morgan <neembi@gmail.com>)
List pgsql-odbc
On 18.03.2013 10:12, Ben Morgan wrote:
> The text type in PostgreSQL is of unlimited length. When accessing a
> view in PostgreSQL, some of the attributes contain data generated
> dynamically that is longer than 255 characters, but it would seem that
> the driver truncates this to 255 characters.
>
> Steps to reproduce:
>
> drop view if exists "public"."too_short_view";
>
> drop table if exists "public"."too_short";
>
> create table "public"."too_short" (id serial primary key, name text not null);
>
> insert into "public"."too_short" (name) values ('
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc
> tempor risus sit amet nibh venenatis sit amet vehicula augue
> suscipit. Vivamus augue magna, lacinia vel dapibus nec,
> tincidunt quis eros. Duis vehicula hendrerit dui, ut cursus ligula volutpat.
> This is now at least 255 characters long, but this part will be truncated.');
>
> create view "public"."too_short_view" as select id, xmlelement(name
> xml, name) from "public"."too_short";
>
> select * from "public"."too_short_view";

Works for me with the attached test program. It prints the whole field
without truncation:

> connected
> <xml>
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc
> tempor risus sit amet nibh venenatis sit amet vehicula augue
> suscipit. Vivamus augue magna, lacinia vel dapibus nec,
> tincidunt quis eros. Duis vehicula hendrerit dui, ut cursus ligula volutpat.
> This is now at least 255 characters long, but this part will be truncated.</xml>

I think the driver will return 255 as the max length of a text field,
when the application asks for the field length with the SQLGetTypeInfo()
function. Maybe some other functions, too, I'm not sure. That's just an
arbitrary number, because the driver has to return something, and it can
be changed by setting the MaxVarcharSize setting in the ODBC driver
configuration (odbc.ini). You could try setting that to higher value.

- Heikki

Attachment

pgsql-odbc by date:

Previous
From: Ben Morgan
Date:
Subject: Bug: attributes dynamically filled (e.g. xml) truncated
Next
From: Barry Bell
Date:
Subject: Re: Bug: attributes dynamically filled (e.g. xml) truncated