Additional accessors via the Extension API ?

Поиск
Список
Период
Сортировка
От Markur Sens
Тема Additional accessors via the Extension API ?
Дата
Msg-id 6D4DE1F2-70C9-4BC4-92FD-0699BE0F8952@gmail.com
обсуждение исходный текст
Ответы Aw: Additional accessors via the Extension API ?  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Re: Additional accessors via the Extension API ?  (Julien Rouhaud <rjuju123@gmail.com>)
Список 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
corePG 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()


The only relevant patch I could find is [1] but it’s a dead-end

[1] https://www.postgresql.org/message-id/20210501072458.adqjoaqnmhg4l34l%40nol




В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Strange results when casting string to double
Следующее
От: Karsten Hilbert
Дата:
Сообщение: Aw: Additional accessors via the Extension API ?