char/varchar truncation - Mailing list pgsql-hackers

From Stephan Szabo
Subject char/varchar truncation
Date
Msg-id 20020802194318.C46821-100000@megazone23.bigpanda.com
Whole thread Raw
Responses Re: char/varchar truncation  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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?



pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: FUNC_MAX_ARGS benchmarks
Next
From: Tom Lane
Date:
Subject: Re: FUNC_MAX_ARGS benchmarks