473,465 Members | 1,373 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Function parameters of rowtype

How are function parameters of rowtype specified when
calling them from a client such as libpq? Is there a syntax
similar to that for arrays? (eg, {x, y, z} )

Thanks,
Iker

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 22 '05 #1
3 4767
Iker Arizmendi <ik**@research.att.com> writes:
How are function parameters of rowtype specified when
calling them from a client such as libpq?


Something like
select myfunc(t.*) from tab t where ...

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 22 '05 #2
But what if there is no table? Instead, is there
some way to specify the row tuple explicitly, similar
to what is done for arrays? I'd like to create a type
and define an instance of that type as part of the
SQL statement. For example,

CREATE TYPE user_t
{
id varchar,
pwd varchar
};

CREATE FUNCTION add_user(user_t)
RETURNS INT4 AS
DECLARE
p_user ALIAS FOR $1;
BEGIN
INSERT INTO user (id, pwd)
VALUES (p_user.id, p_user.pwd);
-- etc, etc, etc
END

then, from the client I might do something like:

SELECT add_user('{john, john123}');

with something like this I can get around Postgres'
limit of 32 parameters without having to compile a
custom version of the DB. One of the entities we're
working has many more than 32 parts which I'd rather
not have to split.

Regards,
Iker
Tom Lane wrote:
Iker Arizmendi <ik**@research.att.com> writes:
How are function parameters of rowtype specified when
calling them from a client such as libpq?

Something like
select myfunc(t.*) from tab t where ...

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 22 '05 #3
Does Postgres provide a builtin mechanism to
obtain the IP address of the client that is executing
the current query?

Thanks,
Iker
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sri | last post by:
how to handle a situation where i wnt a variable of type ref cursor. TYPE refCur IS REF CURSOR; rc refCur; myRow rc%rowtype; -- How can I make this work??? The whole problem is that only on...
4
by: ezra epstein | last post by:
Aother head banger for me. Below is a complete example of the code Using Postgres 7.4, the function "test" gets this: psql:temp3.sql:10: ERROR: syntax error at or near "%" at character 135...
12
by: Newbie | last post by:
how can i call an oracle function to get data without using a select statement or stored procedures? given a project_no, i need to call the function: ops$sqltime.pa_new_job_no_fn which will...
0
by: Federico Pedemonte | last post by:
Hi all, Imagine I have a PL/pgSQL function called myfunction that returns a rowtype like this CREATE TYPE mytype AS (a integer, b integer, c integer); Imagine that I often need only 1...
14
by: Karl O. Pinc | last post by:
Hi, Thought perhaps some other eyes than mine can tell if I'm doing something wrong here or if there's a bug somewhere. I've never passed a ROWTYPE varaible to a function but I don't see where...
0
by: Carlos Roberto Chamorro Mostacilla | last post by:
I have a function that receives a Record or a Rowtype, I need to construct a record of a SQL, to modify a field of the record and soon to pass it to the function but when calling the function is...
2
by: Mark Cave-Ayland | last post by:
Hi everyone, I'm trying to write a recursive plpgsql function in PostgreSQL 7.4.2 that given a tree node id (ictid) will return all the nodes below it in the tree, one row per node. When I try...
9
by: Karl O. Pinc | last post by:
I want to return multiple values, but not a set, only a single row, from a plpgsql function and I can't seem to get it to work. (I suppose I'd be happy to return a set, but I can't seem to make...
1
by: l3d007 | last post by:
i found this excerpt on another site to get the sum of a column in gridview u can use the below function double runningtotal ; public void detailsGridView_RowDataBound(object sender,...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.