| From: | jian he <jian(dot)universality(at)gmail(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: coerce_type discard unnecessary CollateExprs |
| Date: | 2026-06-29 13:54:56 |
| Message-ID: | CACJufxHvu4vQwHfZyRmQ+1H75TOMEvPq6Jhd0RiYMPw0waxZbA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, Jun 29, 2026 at 9:38 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> jian he <jian(dot)universality(at)gmail(dot)com> writes:
> > Only the topmost CollateExpr will be used, all others will be dropped.
> > We can apply this to coerce_type also.
> > See the attached minor patch.
>
> It's not apparent to me that this does anything (will there ever
> be a CollateExpr at this stage?), or that it's correct if it does.
> Please provide an example. Not to mention a comment.
>
will there ever be a CollateExpr at this stage?)
Yes. We use coerce_to_target_type->coerce_type, but some places we
just use coerce_type directly.
For example ParseFuncOrColumn->make_fn_arguments->coerce_type
select to_char(1, 'x' collate "C" collate "POSIX");
Without the patch: After make_fn_arguments->coerce_type the second fargs is:
{COLLATEEXPR
:arg
{COLLATEEXPR
:arg
{CONST
:consttype 25
:consttypmod -1
:constcollid 100
:constlen -1
:constbyval false
:constisnull false
:location 18
:constvalue 5 [ 20 0 0 0 120 ]
}
:collOid 950
:location 22
}
:collOid 951
:location 34
}
With the patch:
{COLLATEEXPR
:arg
{CONST
:consttype 25
:consttypmod -1
:constcollid 100
:constlen -1
:constbyval false
:constisnull false
:location 18
:constvalue 5 [ 20 0 0 0 120 ]
}
:collOid 951
:location 34
}
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2026-06-29 13:56:35 | Re: pg_createsubscriber --dry-run logging concerns |
| Previous Message | Ethan Mertz | 2026-06-29 13:51:40 | Re: [PATCH] Improving index selection for logical replication apply with replica identity full |