From: hamann.w@t-online.de
To: pgsql-general@lists.postgresql.org
Subject: trouble writing plpgsql
Date: 22 Dec 2022 11:37:22 -0000
Message-ID: <wolfgang-1221222123722.A0128333@linux-tuxedo> (raw)
Hi,
I want to make a function to parsetext and return key-value pairs
create or replace function extractinfo (text) returns table (key char[1], val text)
language plpgsql as $$
I first tried
declare
xx record;
begin
....
xx.key = ....; xx.val = ....;
return next xx:
This is not possible because xx needs to know its structure before the fields can be assiged to.
Could I declare xx as having these fields in the first place, do Ineedto create a type for key, val
first?
Wolfgang Hamann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: hamann.w@t-online.de
Subject: Re: trouble writing plpgsql
In-Reply-To: <wolfgang-1221222123722.A0128333@linux-tuxedo>
References: <wolfgang-1221222123722.A0128333@linux-tuxedo>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox