Re: How to set alias data type?

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: Shaozhong SHI <shishaozhong(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: How to set alias data type?
Date: 2021-11-24 14:10:27
Message-ID: 20211124141027.GB20928@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Achilleas Mantzios 2021-11-24 14:29:58 Re: get last timestamp of table ddl
Previous Message hubert depesz lubaczewski 2021-11-24 14:09:58 Re: get last timestamp of table ddl