Re: Type of text literals

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Steve Baldwin <steve(dot)baldwin(at)gmail(dot)com>
Cc: pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Type of text literals
Date: 2018-07-10 22:54:35
Message-ID: 5273.1531263275@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Steve Baldwin <steve(dot)baldwin(at)gmail(dot)com> writes:
> 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' ?

There is no "unknown[]" type, so it has to assume something.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message JORGE MALDONADO 2018-07-11 16:05:54 Please advice on a query
Previous Message Steve Baldwin 2018-07-10 22:41:23 Type of text literals