1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-07 00:36:50 +03:00

Make ARRAY(SELECT ...) return an empty array, rather than a NULL, when the

sub-select returns zero rows.  Per complaint from Jens Schicke.  Since this
is more in the nature of a definition change than a bug, not back-patched.
This commit is contained in:
Tom Lane
2007-08-26 21:44:25 +00:00
parent 75d5f6fe79
commit 67bf7b919e
3 changed files with 52 additions and 41 deletions

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/plan/subselect.c,v 1.123 2007/07/18 21:40:57 tgl Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/plan/subselect.c,v 1.124 2007/08/26 21:44:25 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -208,10 +208,10 @@ generate_new_param(PlannerInfo *root, Oid paramtype, int32 paramtypmod)
/*
* Get the datatype of the first column of the plan's output.
*
* This is a hack to support exprType(), which doesn't have any way to get
* at the plan associated with a SubPlan node. We really only need the value
* for EXPR_SUBLINK and ARRAY_SUBLINK subplans, but for consistency we set
* it always.
* This is stored for ARRAY_SUBLINK and for exprType(), which doesn't have any
* way to get at the plan associated with a SubPlan node. We really only need
* the value for EXPR_SUBLINK and ARRAY_SUBLINK subplans, but for consistency
* we set it always.
*/
static Oid
get_first_col_type(Plan *plan)