pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: A. Kretschmer <andreas.kretschmer@schollglas.com>
To: pgsql-sql@postgresql.org
Subject: Re: plpgsql function question
Date: Tue, 3 Apr 2007 21:24:19 +0200
Message-ID: <20070403192419.GA19007@a-kretschmer.de> (raw)
In-Reply-To: <BAY131-W18D3A18906E05E2B1E90CCB0670@phx.gbl>
References: <BAY131-W18D3A18906E05E2B1E90CCB0670@phx.gbl>

am  Tue, dem 03.04.2007, um 11:33:39 -0700 mailte Karthikeyan Sundaram folgendes:
> Hi,
>  
>   I guess there is some misunderstanding from my question

Maybe.

>  
>   Let me elaborate more clearly.
>  
>    My Table is
>  
>  Create table a (
>  i int,
>  j varchar(20),
>  k date);
>  
> Create or replace function a_func (in p_i int, in p_j varchar, in p_k date)
> returns int as
> $$
>   ----- do the validation
>   return 1;
> $$
> language 'plpgsql';
>  
> This works fine
>  
> What I want is something like this
> create or replace functinon a_func (in a%rowtype) returns int as
> $$
>    ---- do the validation
> $$
> language 'plpgsql';

What's the reason? For an INSERT or UPDATE - check? You can use a
TRIGGER and check the NEW-structure. Or create a new type, based on the
table-structure. Than you can create your function.

test=# create type a as ( i int, j varchar(20), k date);
CREATE TYPE
test=*# create function my_a (IN foo a) returns int as $$begin return 1; end; $$ language plpgsql;
CREATE FUNCTION
test=*# 


> > Date: Tue, 3 Apr 2007 20:18:43 +0200
> > From: akretschmer@spamfence.net
> > To: pgsql-sql@postgresql.org
> > Subject: Re: [SQL] plpgsql function question

Please, no silly text above and fullquote below, i'm reading from top to
bottom...


Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net



view thread (7+ messages)  latest in thread

Message-ID: <20070403192419.GA19007@a-kretschmer.de>
Permalink:  ../20070403192419.GA19007@a-kretschmer.de/
Also on:    postgresql.org/message-id/20070403192419.GA19007@a-kretschmer.de

 · 

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: andreas.kretschmer@schollglas.com
  Subject: Re: plpgsql function question
  In-Reply-To: <20070403192419.GA19007@a-kretschmer.de>

* 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