Thread: varchar (no 'N') vs. text
Let's say I have a database with two tables, a and b. Each has one column. 'a' has a column 't' of type text. 'b' has a column 'v' of type 'varchar' (no length specified). If I join the two tables, I see in the plan something that looks like this: Merge Cond: (a.t = (b.v)::text) I thought 'character varying' (aka varchar) sans length was an alias for text. Is it not? -- Jon
Jon Nelson <jnelson+pgsql@jamponi.net> writes: > I thought 'character varying' (aka varchar) sans length was an alias > for text. Is it not? It has the same behavior, but it is a distinct type, so dummy coercions are needed. regards, tom lane
On Fri, Feb 4, 2011 at 1:18 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > Jon Nelson <jnelson+pgsql@jamponi.net> writes: >> I thought 'character varying' (aka varchar) sans length was an alias >> for text. Is it not? > > It has the same behavior, but it is a distinct type, so dummy coercions > are needed. Are there any performance implications for this dummy coercion? Especially in joins. -- Jon