pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
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 






view thread (2+ messages)  latest in thread

Message-ID: <wolfgang-1221222123722.A0128333@linux-tuxedo>
Permalink:  ../wolfgang-1221222123722.A0128333@linux-tuxedo/
Also on:    postgresql.org/message-id/wolfgang-1221222123722.A0128333@linux-tuxedo

 · 

reply

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