Re: obtaining proc oid given a oper id

2023-08-10 Thread CK Tan
Found it. /* * get_opcode * * Returns the regproc id of the routine used to implement an * operator given the operator oid. */ RegProcedure get_opcode(Oid opno) On Thu, Aug 10, 2023 at 1:17 PM CK Tan wrote: > > Hi Hackers, is there a function that would

obtaining proc oid given a oper id

2023-08-10 Thread CK Tan
Hi Hackers, is there a function that would lookup the proc that implements an operator? Thanks, -cktan

Re: PG_FREE_IF_COPY extraneous in numeric_cmp?

2023-02-25 Thread CK Tan
Thanks! On Fri, Feb 24, 2023 at 2:16 PM Tom Lane wrote: > > CK Tan writes: > > Isn't it true that pfree() will never be called by PG_FREE_IF_COPY? > > No. You're forgetting the possibility that PG_GETARG_NUMERIC will > have to de-toast a toasted input. Granted, numeri

PG_FREE_IF_COPY extraneous in numeric_cmp?

2023-02-24 Thread CK Tan
Hi hackers, I have a question on the code below: Datum numeric_cmp(PG_FUNCTION_ARGS) { Numeric num1 = PG_GETARG_NUMERIC(0); Numeric num2 = PG_GETARG_NUMERIC(1); int result; result = cmp_numerics(num1, num2); PG_FREE_IF_COPY(num1, 0); PG_FREE_IF_COPY(num2, 1);

Re: missing PG_FREE_IF_COPY in textlike() and textnlike() ?

2022-09-16 Thread CK Tan
Got it. It is a leak-by-design for efficiency. Thanks, -cktan On Fri, Sep 16, 2022 at 12:03 AM Tom Lane wrote: > > CK Tan writes: > > I see in the texteq() function calls to DatumGetTextPP() are followed > > by conditional calls to PG_FREE_IF_COPY. e.g. > &g

missing PG_FREE_IF_COPY in textlike() and textnlike() ?

2022-09-16 Thread CK Tan
Hi Hackers, I see in the texteq() function calls to DatumGetTextPP() are followed by conditional calls to PG_FREE_IF_COPY. e.g. https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/varlena.c#L1792 text *targ1 = DatumGetTextPP(arg1); text *targ2 = DatumGetTextPP(arg2);

Clean up code

2021-02-08 Thread CK Tan
Hi, can someone point me to the code that cleans up temp files should a query crashed unexpectedly? Thanks!

Re: Having query cache in core

2018-05-11 Thread CK Tan
On Sat, May 12, 2018 at 8:18 AM, Tatsuo Ishii wrote: > > > > How do you handle tables hiding behind views? Also how does cached > entries > > in pgpools know if some tables are modified without going thru pgpool, eg > > pgplsql or trigger or via psql directly? > > Pgpool-II

Re: Having query cache in core

2018-05-11 Thread CK Tan
On Fri, May 11, 2018, 10:26 PM Tatsuo Ishii wrote: > > > > > I think you need to know which tables are involved and if they were > > modified. > > Of course. While creating a cache entry for a SELECT, we need to > analyze it and extract tables involved in the SELECT. The

Re: Having query cache in core

2018-05-11 Thread CK Tan
On Fri, May 11, 2018, 7:13 PM Tatsuo Ishii wrote: > > You could probably write an extension for that, though. I think the > > planner hook and custom scans give you enough flexibility to do that > > without modifying the server code. > > Thanks for the advice. But I rather