How to set alias data type?

Поиск
Список
Период
Сортировка
Искать

How to set alias data type?

От:
Shaozhong SHI <shishaozhong@gmail.com>
Дата:
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 

It simply does not work.

Regards,

David

Re: How to set alias data type?

От:
hubert depesz lubaczewski <depesz@depesz.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



FAQ