pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedHow to set alias data type?
2+ messages / 2 participants
[nested] [flat]
* How to set alias data type?
@ 2021-11-24 13:57 Shaozhong SHI <shishaozhong@gmail.com>
2021-11-24 14:10 ` Re: How to set alias data type? hubert depesz lubaczewski <depesz@depesz.com>
0 siblings, 1 reply; 2+ messages in thread
From: Shaozhong SHI @ 2021-11-24 13:57 UTC (permalink / raw)
To: pgsql-general <pgsql-general@lists.postgresql.org>
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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: How to set alias data type?
2021-11-24 13:57 How to set alias data type? Shaozhong SHI <shishaozhong@gmail.com>
@ 2021-11-24 14:10 ` hubert depesz lubaczewski <depesz@depesz.com>
0 siblings, 0 replies; 2+ messages in thread
From: hubert depesz lubaczewski @ 2021-11-24 14:10 UTC (permalink / raw)
To: Shaozhong SHI <shishaozhong@gmail.com>; +Cc: pgsql-general <pgsql-general@lists.postgresql.org>
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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2021-11-24 14:10 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-11-24 13:57 How to set alias data type? Shaozhong SHI <shishaozhong@gmail.com>
2021-11-24 14:10 ` hubert depesz lubaczewski <depesz@depesz.com>
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