Re: Identifying no-op length coercions
Noah Misch <noah@leadboat.com>
From: Noah Misch <noah@leadboat.com>
To: Jim Nasby <jim@nasby.net>
Cc: Alexey Klyukin <alexk@commandprompt.com>, Tom Lane <tgl@sss.pgh.pa.us>, Robert Haas <robertmhaas@gmail.com>, pgsql-hackers@postgresql.org
Date: 2011-06-03T16:27:40Z
Lists: pgsql-hackers
On Fri, Jun 03, 2011 at 10:43:17AM -0500, Jim Nasby wrote: > On Jun 3, 2011, at 10:11 AM, Alexey Klyukin wrote: > >> Is your interest in cheap varchar(N)->varchar(N+M) conversions specifically, or > >> in some broader application of this facility? > > > > Exactly varchar conversions. > > Why limit it to varchar? Shouldn't we be able to do this for any varlena? The only challenge I see is numeric; we'd need to ensure that both size and precision are not decreasing. I've implemented support for varchar, varbit, numeric, time, timetz, timestamp, timestamptz, and interval. However, I'll probably submit only varchar in the initial infrastructure patch and the rest in followup patches in a later CF. For numeric, we store the display scale in every datum, so any change to it rewrites the table. You'll be able to cheaply change numeric(7,2) to numeric(9,2) but not to numeric(9,3).