From: Richard Broersma Jr <rabroersma@yahoo.com>
To: pgsql-odbc@postgresql.org, Tom Hart <tomhart@coopfed.org>
Subject: Re: odbc varchar/longvarchar default setting
Date: Fri, 23 Nov 2007 16:30:18 -0800 (PST)
Message-ID: <214516.917.qm@web31802.mail.mud.yahoo.com> (raw)
In-Reply-To: <474753CF.5050307@coopfed.org>
here is what the ODBC faq has to say:
6.5) With MS Access, why can't I index on text fields -OR- why do I get "Invalid field definition 'field'" in definition of index or relationship?
Text fields are mapped to SQL_LONGVARCHAR by default. As a result MS Access treats these colomns as "Memo" types. The good news is that you can store up to the PostgreSQL block size limit in a text column. PostgreSQL has a tuple limit of just under 8k prior to version 7.1 which includes a new feature called TOAST which allows the storage of much larger strings.
You can change the mapping of Text fields to SQL_VARCHAR by unchecking the Advanced driver option "Text as LongVarchar" under Data Type Options. This should allow text fields to be used but you will be limited to the maximum size of a varchar.
--- On Fri, 11/23/07, Tom Hart <tomhart@coopfed.org> wrote:
> From: Tom Hart <tomhart@coopfed.org>
> Subject: [ODBC] odbc varchar/longvarchar default setting
> To: pgsql-odbc@postgresql.org
> Date: Friday, November 23, 2007, 2:27 PM
> Hey everybody, and hey again everybody I know from the
> General list.
>
> I wasn't sure how to report this, as I don't see it
> as a bug, but I
> wanted to make you guys aware of it.
>
> The default setting in the odbc driver is to pass pg
> 'text' datatypes as
> LongVarChar (with a default length of 8190). However in
> Access (and as
> I'm told Crystal Reports as well) it converts this into
> a 'memo'
> datatype instead of a 'text' datatype (in access
> text = varchar(255)).
> This can be fixed by deselecting that option, and making
> sure the
> varchar length is 255, but I'm curious as to why this
> isn't the default.
> Granted postgresql isn't developed for or targeted
> towards Windows
> users, but I believe that a large number of people using
> this odbc
> driver are using it to connect to things like access and
> crystal
> reports, and it seems to me that varchar(255) would make
> more sense as a
> default. Of course I understand that there's the
> possibility of lost
> data (if your text fields are past 255 characters), but
> there's the
> possibility of that with the longvarchar as well, and
> having
> varchar(255) as the default would foster a higher level of
> interoperability, especially with access users.
>
> I'm sure you guys have heard this before, but why
> isn't this the
> default, and are there any plans or issues with making this
> the default?
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an
> appropriate
> subscribe-nomail command to majordomo@postgresql.org
> so that your
> message can get through to the mailing list cleanly
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: rabroersma@yahoo.com, tomhart@coopfed.org
Subject: Re: odbc varchar/longvarchar default setting
In-Reply-To: <214516.917.qm@web31802.mail.mud.yahoo.com>
References: <474753CF.5050307@coopfed.org> <214516.917.qm@web31802.mail.mud.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox