By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,418 Members | 1,311 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,418 IT Pros & Developers. It's quick & easy.

Function parameters of rowtype

P: n/a
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
Share this Question
Share on Google+
3 Replies

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.