char/varchar truncation

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: char/varchar truncation
Date: 2002-08-03 02:52:52
Message-ID: 20020802194318.C46821-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


I wonder if we actually did the right thing with this.

For example:
select cast('ab' as char(1));

Using sql92's definitions, I read TD as
a fixed length character string and
SD as the same.

Which means I think the section that
comes into play is:

SQL92 6.10 GR5 c ii

ii) If the length in characters of SV is larger than LTD, then
TV is the first LTD characters of SV. If any of the re-
maining characters of SV are non-<space> characters, then a
completion condition is raised: warning-string data, right
truncation.

It looks like SQL99's cast specification is similar for this
case.

Wouldn't that mean the operation is supposed to succeed with
diagnostic information since it's a completion condition not
an exception condition?

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-08-03 03:26:18 Re: Planned simplification of catalog index updates
Previous Message Thomas Lockhart 2002-08-03 02:44:34 Re: FUNC_MAX_ARGS benchmarks