From: | "Marcin Krawczyk" <jankes(dot)mk(at)gmail(dot)com> |
---|---|
To: | "Pawel Socha" <pawel(dot)socha(at)gmail(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: record type |
Date: | 2008-07-11 09:54:25 |
Message-ID: | 95f6bf9b0807110254u225f5952xee4867be99ca14a3@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Nice thanks a lot.
Niezłe, dzieki.
regards
pozdrowienia
mk
2008/7/11 Pawel Socha <pawel(dot)socha(at)gmail(dot)com>:
>
>
> 2008/7/10 Marcin Krawczyk <jankes(dot)mk(at)gmail(dot)com>:
>
> Hi. I need to know whether it's possible for a plpgsql function to accept
>> record type parameters ? Is there a way to accomplish that ?
>> I need to use something like ('1','2','3') as a parameter.
>>
>> regards
>> mk
>>
>
> All about record type
>
> http://www.postgresql.org/docs/8.3/interactive/plpgsql-declarations.html#PLPGSQL-DECLARATION-RECORDS
> section 38.3.4
>
>
> but, try this ;-)
>
> merlin=# create table your_table(col1 int, col2 varchar(12), col3 int);
> CREATE TABLE
>
> merlin=# create or replace function test_1(val_of your_table) returns void
> as $$
> declare
> begin
> insert into your_table values(val_of.col1, val_of.col2, val_of.col3);
> end;
> $$ LANGUAGE plpgsql;
> CREATE FUNCTION
>
>
> CREATE FUNCTION
> merlin=# select test_1((1,'test',2));
> test_1
> --------
>
> (1 row)
>
>
> merlin=# select * from your_table ;
> col1 | col2 | col3
> ------+------+------
> 1 | test | 2
> (1 row)
>
> Time: 0.380 ms
>
>
>
>
> --
> --
> Serdecznie pozdrawiam
>
> Pawel Socha
> pawel(dot)socha(at)gmail(dot)com
>
> programista/administrator
>
> perl -le 's**02).4^&-%2,).^9%4^!./4(%2^3,!#+7!2%^53%2&**y%& -;^[%"`-{
> a%%s%%$_%ee'
From | Date | Subject | |
---|---|---|---|
Next Message | Krejci, Pavel | 2008-07-11 12:08:16 | ESQL CREATE DATABASE |
Previous Message | Pawel Socha | 2008-07-11 07:29:39 | Re: record type |