Re: How to set alias data type? - Mailing list pgsql-general

From hubert depesz lubaczewski
Subject Re: How to set alias data type?
Date
Msg-id 20211124141027.GB20928@depesz.com
Whole thread Raw
In response to How to set alias data type?  (Shaozhong SHI <shishaozhong@gmail.com>)
List pgsql-general
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




pgsql-general by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: get last timestamp of table ddl
Next
From: Achilleas Mantzios
Date:
Subject: Re: get last timestamp of table ddl