pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feedAW: Truncation of char, varchar types
4+ messages / 4 participants
[nested] [flat]
* AW: Truncation of char, varchar types
@ 2001-04-10 10:46 Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>
0 siblings, 2 replies; 4+ messages in thread
From: Zeugswetter Andreas SB @ 2001-04-10 10:46 UTC (permalink / raw)
To: 'Peter Eisentraut' <peter_e@gmx.net>; pgsql-hackers
> Excessively long values are currently silently truncated when they are
> inserted into char or varchar fields. This makes the entire notion of
> specifying a length limit for these types kind of useless, IMO. Needless
> to say, it's also not in compliance with SQL.
To quote Tom "paragraph and verse please" :-)
> How do people feel about changing this to raise an error in this
> situation?
Can't do.
> Does anybody rely on silent truncation?
Yes, iirc the only thing you are allowed to do is issue a warning,
but the truncation is allowed and must succeed.
(checked in Informix and Oracle)
The appropriate SQLSTATE is: "01004" String data, right truncation
note that class 01 is a "success with warning".
Andreas
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: AW: Truncation of char, varchar types
@ 2001-04-10 13:32 Alessio Bragadini <alessio@albourne.com>
parent: Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>
1 sibling, 0 replies; 4+ messages in thread
From: Alessio Bragadini @ 2001-04-10 13:32 UTC (permalink / raw)
To: pgsql-hackers
Zeugswetter Andreas SB wrote:
> Yes, iirc the only thing you are allowed to do is issue a warning,
> but the truncation is allowed and must succeed.
> (checked in Informix and Oracle)
? As much as I remember, Oracle raises an error. But it's been a few
years since I last touched it, so maybe I'm wrong.
--
Alessio F. Bragadini alessio@albourne.com
APL Financial Services http://village.albourne.com
Nicosia, Cyprus phone: +357-2-755750
"It is more complicated than you think"
-- The Eighth Networking Truth from RFC 1925
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: AW: Truncation of char, varchar types
@ 2001-04-10 16:07 Peter Eisentraut <peter_e@gmx.net>
parent: Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>
1 sibling, 0 replies; 4+ messages in thread
From: Peter Eisentraut @ 2001-04-10 16:07 UTC (permalink / raw)
To: Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>; +Cc: pgsql-hackers
Zeugswetter Andreas SB writes:
> > Excessively long values are currently silently truncated when they are
> > inserted into char or varchar fields. This makes the entire notion of
> > specifying a length limit for these types kind of useless, IMO. Needless
> > to say, it's also not in compliance with SQL.
>
> To quote Tom "paragraph and verse please" :-)
SQL 1992, 9.2 GR 3 e)
"""
If the data type of T is variable-length character string and
the length in characters M of V is greater than the maximum
length in characters L of T, then,
Case:
i) If the rightmost M-L characters of V are all <space>s, then
the value of T is set to the first L characters of V and
the length in characters of T is set to L.
ii) If one or more of the rightmost M-L characters of V are
not <space>s, then an exception condition is raised: data
^^^^^^^^^
exception-string data, right truncation.
"""
Similarly in SQL 1999 and for other data types.
> > How do people feel about changing this to raise an error in this
> > situation?
>
> Can't do.
Why not?
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: AW: Truncation of char, varchar types
@ 2001-04-12 19:35 Mark Butler <butlerm@middle.net>
0 siblings, 0 replies; 4+ messages in thread
From: Mark Butler @ 2001-04-12 19:35 UTC (permalink / raw)
To: pgsql-hackers
Zeugswetter Andreas SB wrote:
> Yes, good. Do we want this in 7.1.0 ? Seems, yes :-(
I agree this change is very good idea, but 7.2 is probably a better target.
- Mark Butler
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2001-04-12 19:35 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-04-10 10:46 AW: Truncation of char, varchar types Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>
2001-04-10 13:32 ` Alessio Bragadini <alessio@albourne.com>
2001-04-10 16:07 ` Peter Eisentraut <peter_e@gmx.net>
2001-04-12 19:35 Re: AW: Truncation of char, varchar types Mark Butler <butlerm@middle.net>
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