Re: Aggregates and row types

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Aggregates and row types
Date: 2017-03-22 03:52:39
Message-ID: 1968.1490154759@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com> writes:
> Is is expected that the first query below can be analysed and planned,
> but the second can't?

> explain select x from (select row(42)) s(x);

> explain select count(x) from (select row(42)) s(x);
> ERROR: record type has not been registered

Well, ideally that wouldn't happen, but making it go away isn't
all that trivial. Try coercing the ROW() expression to some named
composite type. For example, in the regression database this works:

regression=# select count(x) from (select row(42)::int4_tbl) s(x);
count
-------
1
(1 row)

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2017-03-22 04:18:19 Re: Create replication slot in pg_basebackup if requested and not yet present
Previous Message Peter Eisentraut 2017-03-22 03:50:38 Re: [PATCH v1] Add and report the new "in_hot_standby" GUC pseudo-variable.