Column names in rowsets returned from function

Started by Krzysztof Barlikover 16 years ago10 messagesgeneral
Jump to latest
#1Krzysztof Barlik
kbarlik@wp.pl

Hi,

I have a question - is it possible to rename
columns in rowset returned from plpgsql function
delared as 'returns table(...)' ?

It seems it's not possible, even using
'as "column_name"' in internal query and
column names are always the same as in
'table(...)' definition.

If not, could it be possible in the future ?

Thanks,
Krzysztof

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Krzysztof Barlik (#1)
Re: Column names in rowsets returned from function

Krzysztof Barlik <kbarlik@wp.pl> writes:

I have a question - is it possible to rename
columns in rowset returned from plpgsql function
delared as 'returns table(...)' ?

Sure ...

regression=# create function foo() returns table (a int, b text) as
regression-# $$ values (1,'one'), (2,'two') $$ language sql;
CREATE FUNCTION
regression=# select * from foo();
a | b
---+-----
1 | one
2 | two
(2 rows)

regression=# select * from foo() as x(y,z);
y | z
---+-----
1 | one
2 | two
(2 rows)

If that's not what you are talking about, you need to be more
specific about what you are talking about.

regards, tom lane

#3Krzysztof Barlik
kbarlik@wp.pl
In reply to: Tom Lane (#2)
Re: Column names in rowsets returned from function

Hi Tom,

If that's not what you are talking about, you need to be more
specific about what you are talking about.

you are right, I was not specific enough.

I meant a situation where returned rowset
may have different set of column names depending
on data in the database, not on explicit user request.

Regards,
Krzysztof

#4Pavel Stehule
pavel.stehule@gmail.com
In reply to: Krzysztof Barlik (#3)
Re: Column names in rowsets returned from function

2009/9/26 Krzysztof Barlik <kbarlik@wp.pl>:

Hi Tom,

If that's not what you are talking about, you need to be more
specific about what you are talking about.

you are right, I was not specific enough.

I meant a situation where returned rowset
may have different set of column names depending
on data in the database, not on explicit user request.

no this isn't possible yet

regards
Pavel Stehule

Show quoted text

Regards,
Krzysztof

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#5Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Krzysztof Barlik (#3)
Re: Column names in rowsets returned from function

On Saturday 26 September 2009 12:49:03 pm Krzysztof Barlik wrote:

Hi Tom,

If that's not what you are talking about, you need to be more
specific about what you are talking about.

you are right, I was not specific enough.

I meant a situation where returned rowset
may have different set of column names depending
on data in the database, not on explicit user request.

Regards,
Krzysztof

Just to make things clear, is this the same question and situation that Jerzy
Bialas brought up in another post?

http://archives.postgresql.org/pgsql-general/2009-09/msg00922.php

--
Adrian Klaver
aklaver@comcast.net

#6Krzysztof Barlik
kbarlik@wp.pl
In reply to: Adrian Klaver (#5)
Re: Column names in rowsets returned from function

Just to make things clear, is this the same question and situation that
Jerzy Bialas brought up in another post?

http://archives.postgresql.org/pgsql-general/2009-09/msg00922.php

Yes, I didn't know he posted it earlier.
Sorry for the confusion and thanks for response.

Regards,
Krzysztof

#7Krzysztof Barlik
kbarlik@wp.pl
In reply to: Adrian Klaver (#5)
pg_dumpall asking for password for each database

Hi,

is it possible to force pg_dumpall to ask for
password only once (connecting as superuser 'postgres') ?

Entering it for every database is a bit annoying.

Thanks,
Krzysztof

#8Scott Mead
scott.lists@enterprisedb.com
In reply to: Krzysztof Barlik (#7)
Re: pg_dumpall asking for password for each database

2009/10/6 Krzysztof Barlik <kbarlik@wp.pl>

Hi,

is it possible to force pg_dumpall to ask for
password only once (connecting as superuser 'postgres') ?

Entering it for every database is a bit annoying.

Kind of, you'll either use an environment variable:

http://www.postgresql.org/docs/8.4/interactive/libpq-envars.html
(specifically PGPASSWORD)

or the pgpass file:

http://www.postgresql.org/docs/´8.4/interactive/libpq-pgpass.html

--Scott

#9Joshua D. Drake
jd@commandprompt.com
In reply to: Krzysztof Barlik (#7)
Re: pg_dumpall asking for password for each database

On Tue, 2009-10-06 at 22:59 +0200, Krzysztof Barlik wrote:

Hi,

is it possible to force pg_dumpall to ask for
password only once (connecting as superuser 'postgres') ?

Entering it for every database is a bit annoying.

take a look at .pgpass documentation

Thanks,
Krzysztof

--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 503.667.4564
Consulting, Training, Support, Custom Development, Engineering
If the world pushes look it in the eye and GRR. Then push back harder. - Salamander

#10Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Krzysztof Barlik (#7)
Re: pg_dumpall asking for password for each database

Krzysztof Barlik wrote:

Hi,

is it possible to force pg_dumpall to ask for
password only once (connecting as superuser 'postgres') ?

Entering it for every database is a bit annoying.

What version are you running? IIRC it should remember the password
between databases.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.