Type of text literals

From: Steve Baldwin <steve(dot)baldwin(at)gmail(dot)com>
To: pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Type of text literals
Date: 2018-07-10 22:41:23
Message-ID: CAKE1AibZHfvNRt2t_+dMpHOH_+8Hq9TyRbJnt5JrAUMQemkv_g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Can someone please help me understand this:

b2bc_dev=# select pg_typeof('a') as a, pg_typeof(array['a']) as arr;
a | arr
---------+--------
unknown | text[]
(1 row)

Why is a text literal on its own 'unknown' whereas in the context of an
array it assumes 'text' ?

This is pg 10.4 in case it matters.

Thanks,

Steve

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2018-07-10 22:54:35 Re: Type of text literals
Previous Message David Rowley 2018-07-09 10:31:02 Re: An Inesrt on a partitioned table become very slow