Re: PATCH: pageinspect / add page_checksum and bt_page_items(bytea)

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: pageinspect / add page_checksum and bt_page_items(bytea)
Date: 2017-03-17 22:35:36
Message-ID: 3271eac9-9f12-3776-4659-824b8327494e@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 03/17/2017 05:23 PM, Peter Eisentraut wrote:
> I'm struggling to find a good way to share code between
> bt_page_items(text, int4) and bt_page_items(bytea).
>
> If we do it via the SQL route, as I had suggested, it makes the
> extension non-relocatable, and it will also create a bit of a mess
> during upgrades.
>
> If doing it in C, it will be a bit tricky to pass the SRF context
> around. There is no "DirectFunctionCall within SRF context", AFAICT.
>

Not sure what it has to do with DirectFunctionCall? You want to call the
bytea variant from the existing one? Wouldn't it be easier to simply
define a static function with the shared parts, and pass around the
fctx/fcinfo? Not quite pretty, but should work.

>
> I'm half tempted to just rip out the (text, int4) variants.
>

Perhaps. I see pageinspect as a tool for ad-hoc investigations, and I
can't really imagine it being hard-wired into something.

>
> In any case, I think we should add bytea variants to all the btree
> functions, not just the bt_page_items one.
>

I agree, but I think we need to find a way to share the code between the
text/bytea variants. Unless we rip the text ones out, obviously.

Thanks for the work on the patch, BTW.

regards

--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2017-03-17 22:44:44 Introduce expression initialization hook?
Previous Message Bruce Momjian 2017-03-17 22:22:25 Re: Microvacuum support for Hash Index