Aw: Additional accessors via the Extension API ?

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To:
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Aw: Additional accessors via the Extension API ?
Date: 2022-02-20 09:23:27
Message-ID: trinity-4455287d-6da1-4ee4-b4bb-447811798172-1645349006967@3c-app-gmx-bs31
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Suppose I have defined an additional type in a PG extension.
>
> Is it possible to add custom accessors to that type -much like jsonb does- but use an API/hook without touching the core PG grammar & parser?
>
> Hypothetical Examples:
>
> Assuming I have a TextFile type I’d like to implement syntax like:
>
> (‘/home/me/a.txt’::TextFile).firstline
> (‘/home/me/a.txt’::TextFile).lastline
> (‘/home/me/a.txt’::TextFile).countlines()
> (‘/home/me/a.txt’::TextFile).size()
> (‘/home/me/a.txt’::TextFile).datemodified()

Off on a tangent but would file_fdw help in any way ?

Karsten

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Julien Rouhaud 2022-02-20 10:12:57 Re: Additional accessors via the Extension API ?
Previous Message Markur Sens 2022-02-20 06:07:20 Additional accessors via the Extension API ?