From: hubert depesz lubaczewski <depesz@depesz.com>
To: Shaozhong SHI <shishaozhong@gmail.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: How to set alias data type?
Date: Wed, 24 Nov 2021 15:10:27 +0100
Message-ID: <20211124141027.GB20928@depesz.com> (raw)
In-Reply-To: <CA+i5JwbTxucfSepExn4JOSSWsXwaD=3bZVgh__u5O3WjJdNWSQ@mail.gmail.com>
References: <CA+i5JwbTxucfSepExn4JOSSWsXwaD=3bZVgh__u5O3WjJdNWSQ@mail.gmail.com>
On Wed, Nov 24, 2021 at 01:57:06PM +0000, Shaozhong SHI wrote:
> select 'Total' as Total generate result that set Total as a column name
> with unknown type
>
> When trying to cast
> select 'Total' as Total:: text
You need to cast value, and not name.
select 'Total'::text as Total;
Best regards,
depesz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: depesz@depesz.com, shishaozhong@gmail.com
Subject: Re: How to set alias data type?
In-Reply-To: <20211124141027.GB20928@depesz.com>
References: <CA+i5JwbTxucfSepExn4JOSSWsXwaD=3bZVgh__u5O3WjJdNWSQ@mail.gmail.com> <20211124141027.GB20928@depesz.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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