Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nLfNd-0003J5-BJ for pgsql-general@arkaria.postgresql.org; Sun, 20 Feb 2022 06:07:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nLfNa-0007TL-4W for pgsql-general@arkaria.postgresql.org; Sun, 20 Feb 2022 06:07:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nLfNZ-0007TC-O8 for pgsql-general@lists.postgresql.org; Sun, 20 Feb 2022 06:07:29 +0000 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nLfNU-0006HX-Rc for pgsql-general@lists.postgresql.org; Sun, 20 Feb 2022 06:07:28 +0000 Received: by mail-ej1-x635.google.com with SMTP id hw13so24828021ejc.9 for ; Sat, 19 Feb 2022 22:07:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=WLGYPkh5QkMAzlcSZWxNhvpSwbpuVeAD6/kgkHrkiDQ=; b=VjV97jgu7k2ES9PnZ/IL68VPJulqz0vt96pt9tjFxBiw03sShf8djXULVUlfW7kf2M CaGi9SLBW3bFYwyVHQdj1rP0/WGgHliLsr7fQCE/1h6GFgo6r2zOg5cWndzIAKev7CWU FpsQ9k+gHYVr4KunpvOWgzWxfxQS1GtIcgGriR54i26Y1mswaQCKrlZcnVXNGPuDti8i qQZRtgMt9Lxj5Q7oi//hoNhDPHRX66sXigABWXdADW0FuWBu4DAQTb9tRVWkkZyZlTTm ACGoFVZUB+3/k6unfbhkJOjx9wMcHXLiXnxShWQDvM7aOa5hKK+ttQwMrUkuqju2p7/j 6E2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=WLGYPkh5QkMAzlcSZWxNhvpSwbpuVeAD6/kgkHrkiDQ=; b=FfgKnYCV01v08vGIT9cbAGWL8iE5kaKqvzQAt0mch1WUVgF3oErVytprakt6qoyXTP +jRhhDlJB7ftvguT739I3MqjfhyJ1Zp4AIujk98swyPDRxEK4C/R1ZVKMIm6e6e+FBnf hlhZm/phD35UkfzLJxklXvRyJEmWWLzGjGuQZAg/iJMfyWVppz6Wx1kaD1GLqXQl18n6 +xl4x9UJLyWH1m7CAy4OkwWYYSFonPAuaTGrtPPNamoUsv2F9PM5QgMlZInCqbuN5JUw pHEsCQN2SIyjB3zU6T/65sAxDFzlHJEFD+wyQEG7UALdFs5A5MYXZqyDwtFnRspW9Ju8 VEDg== X-Gm-Message-State: AOAM532VaYEHbANjUS/U6G+wLrR1mssZC8pJmKPlkSr4ToWF7kP3yxpJ id0bo7BEYgoVz6YONCtAdybTkPA5r5I= X-Google-Smtp-Source: ABdhPJzLqjilwJN51Z4B4urJAXT2KIsjVZV6ss7bErb/lhOk5/D47fNOlfoE9m0s01MJh7BEEiEU3g== X-Received: by 2002:a17:906:be1:b0:6ce:c3c8:b4b6 with SMTP id z1-20020a1709060be100b006cec3c8b4b6mr11533110ejg.617.1645337242534; Sat, 19 Feb 2022 22:07:22 -0800 (PST) Received: from smtpclient.apple (ppp-94-66-221-132.home.otenet.gr. [94.66.221.132]) by smtp.gmail.com with ESMTPSA id i6sm3886294eja.132.2022.02.19.22.07.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Feb 2022 22:07:22 -0800 (PST) From: Markur Sens Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.60.0.1.1\)) Subject: Additional accessors via the Extension API ? Message-Id: <6D4DE1F2-70C9-4BC4-92FD-0699BE0F8952@gmail.com> Date: Sun, 20 Feb 2022 08:07:20 +0200 To: pgsql-general X-Mailer: Apple Mail (2.3693.60.0.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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?=20= Hypothetical Examples:=20 Assuming I have a TextFile type I=E2=80=99d like to implement syntax = like: (=E2=80=98/home/me/a.txt=E2=80=99::TextFile).firstline (=E2=80=98/home/me/a.txt=E2=80=99::TextFile).lastline (=E2=80=98/home/me/a.txt=E2=80=99::TextFile).countlines() (=E2=80=98/home/me/a.txt=E2=80=99::TextFile).size() (=E2=80=98/home/me/a.txt=E2=80=99::TextFile).datemodified() The only relevant patch I could find is [1] but it=E2=80=99s a dead-end [1] = https://www.postgresql.org/message-id/20210501072458.adqjoaqnmhg4l34l%40no= l