pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Flegl <ml_flegl@centrum.cz>
To: pgsql-sql@postgresql.org
Subject: How to get text representation of composite value?
Date: Tue, 24 Apr 2007 14:12:38 +0200
Message-ID: <200704241412.8228@centrum.cz> (raw)

Hello,
  I'd like to ask you for a help. I'm in trouble with $subj. I need something like documentation of PostgreSQL in chapter 8.11.5 says.
Inside trigger I have record type NEW which is composite type.  How could one do something like :

           text_var:=to_char(NEW)

 So if NEW.at1='test' and NEW.at2=100 I would get string: 'test',100

 But the problem is then if trigger is generally used for many tables, I
 don't know number of elements and so on.

As I know, for element types are defined output function, and I can use this:
          SELECT textin(point_out('(1,1)'::point))::varchar;

Anybody can help me? 
P.S. pl/pgsql would be best way if it possible.


David F




Message-ID: <200704241412.8228@centrum.cz>
Permalink:  ../200704241412.8228@centrum.cz/
Also on:    postgresql.org/message-id/200704241412.8228@centrum.cz

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ml_flegl@centrum.cz
  Subject: Re: How to get text representation of composite value?
  In-Reply-To: <200704241412.8228@centrum.cz>

* 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