pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Randall Perry <rgp@systame.com>
Cc: Henshall, Stuart - WCP <SHenshall@westcountrypublications.co.uk>
Cc: pgsql-general@postgresql.org
Cc: pgsql-admin@postgresql.org
Cc: pgsql-odbc@postgresql.org
Subject: Re: [GENERAL] Access 'field too long' error
Date: Mon, 02 Sep 2002 12:24:00 -0400
Message-ID: <23457.1030983840@sss.pgh.pa.us> (raw)
In-Reply-To: <B998FE10.19D3E%rgp@systame.com>
References: <B998FE10.19D3E%rgp@systame.com>

Randall Perry <rgp@systame.com> writes:
> Here's my view definition:
>            View "v_cust_rev_by_month"
>     Column     |         Type          | Modifiers
> ---------------+-----------------------+-----------
>  id            | integer               |
>  cust_code     | character varying(25) |
>  date          | date                  |
>  month         | text                  |
>  total_uploads | integer               |
>  revenues      | numeric               |
>  balance       | numeric               |

> In testing, if I create a new table from this view and don't include the
> numeric fields, it links to access ok.
> If include either of the numeric fields I get the 'field is too long' error.
> If I link the original table the view is derived from (the view is 3 steps
> removed from the original because it calls on views that call on views) I
> don't get the error.

My bet is that something on the client side is getting confused by the
lack of precision specification for the numeric columns in the view.  It
works on the original table because that has a precision spec.

You can probably work around this by redefining the view with explicit
casts.  Note the difference in the following examples:

regression=# create table foo(f1 numeric(7,2));
CREATE
regression=# create view v as select f1, f1+1 from foo;
CREATE
regression=# create view v2 as select f1, (f1+1)::numeric(7,2) from foo;
CREATE
regression=# \d v
              View "v"
  Column  |     Type     | Modifiers
----------+--------------+-----------
 f1       | numeric(7,2) |
 ?column? | numeric      |
View definition: SELECT foo.f1, (foo.f1 + '1'::"numeric") FROM foo;

regression=# \d v2
             View "v2"
 Column  |     Type     | Modifiers
---------+--------------+-----------
 f1      | numeric(7,2) |
 numeric | numeric(7,2) |
View definition: SELECT foo.f1, ((foo.f1 + '1'::"numeric"))::numeric(7,2) AS "numeric" FROM foo;


In the longer run it might be possible to tweak the ODBC driver to
prevent this failure --- I'm not sure what ODBC does when it sees a
-1 typmod for a numeric column, but perhaps it could do something
different than it does now.

			regards, tom lane



view thread (5+ messages)  latest in thread

Message-ID: <23457.1030983840@sss.pgh.pa.us>
Permalink:  ../23457.1030983840@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/23457.1030983840@sss.pgh.pa.us

 · 

reply

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-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, rgp@systame.com, SHenshall@westcountrypublications.co.uk, pgsql-general@postgresql.org, pgsql-odbc@postgresql.org
  Subject: Re: [GENERAL] Access 'field too long' error
  In-Reply-To: <23457.1030983840@sss.pgh.pa.us>
  References: <B998FE10.19D3E%rgp@systame.com> <23457.1030983840@sss.pgh.pa.us>

* 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