pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedhow to get the source table & field name of a view field
5+ messages / 4 participants
[nested] [flat]
* how to get the source table & field name of a view field
@ 2002-11-07 09:12 Prime Ho <ho@optimasoft.com.tw>
2002-11-07 14:25 ` Re: how to get the source table & field name of a view field Achilleus Mantzios <achill@matrix.gatewaynet.com>
2002-11-07 15:08 ` Re: how to get the source table & field name of a view field Ken Kennedy <kkennedy@kenzoid.com>
0 siblings, 2 replies; 5+ messages in thread
From: Prime Ho @ 2002-11-07 09:12 UTC (permalink / raw)
To: pgsql-sql
Hi,
Could you tell me how to get view field's source table and field name?
another word, how could I know the view field come from?
Regards,
Ho
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: how to get the source table & field name of a view field
2002-11-07 09:12 how to get the source table & field name of a view field Prime Ho <ho@optimasoft.com.tw>
@ 2002-11-07 14:25 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
1 sibling, 0 replies; 5+ messages in thread
From: Achilleus Mantzios @ 2002-11-07 14:25 UTC (permalink / raw)
To: Prime Ho <ho@optimasoft.com.tw>; +Cc: pgsql-sql
On Thu, 7 Nov 2002, Prime Ho wrote:
> Hi,
>
> Could you tell me how to get view field's source table and field name?
> another word, how could I know the view field come from?
SELECT definition from pg_views where viewname='<your view name>';
>
> Regards,
> Ho
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
==================================================================
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
Nikis 4, Glyfada
Athens 16610
Greece
tel: +30-10-8981112
fax: +30-10-8981877
email: achill@matrix.gatewaynet.com
mantzios@softlab.ece.ntua.gr
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: how to get the source table & field name of a view field
2002-11-07 09:12 how to get the source table & field name of a view field Prime Ho <ho@optimasoft.com.tw>
@ 2002-11-07 15:08 ` Ken Kennedy <kkennedy@kenzoid.com>
1 sibling, 0 replies; 5+ messages in thread
From: kkennedy@kenzoid.com @ 2002-11-07 15:08 UTC (permalink / raw)
To: pgsql-sql
On Thu, Nov 07, 2002 at 05:12:20PM +0800, Prime Ho wrote:
> Hi,
>
> Could you tell me how to get view field's source table and field name?
> another word, how could I know the view field come from?
>
\d view_name should give you the view definition in pqsl.
--
Ken Kennedy | http://www.kenzoid.com | kenzoid@io.com
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: how to get the source table & field name of a view field
@ 2002-11-07 14:06 Christoph Haller <ch@rodos.fzk.de>
0 siblings, 0 replies; 5+ messages in thread
From: Christoph Haller @ 2002-11-07 14:06 UTC (permalink / raw)
To: Prime Ho <ho@optimasoft.com.tw>; +Cc: pgsql-sql
> Could you tell me how to get view field's source table and field name?
> another word, how could I know the view field come from?
Within psql, use
\d <viewname>
to learn about the view's column names and types and the view
definition.
If you were thinking about querying system tables to get this
information,
start psql with the "-E" option to see how this \d <viewname> command
is implemented.
Regards, Christoph
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: how to get the source table & field name of a view field
@ 2002-11-08 08:22 Christoph Haller <ch@rodos.fzk.de>
0 siblings, 0 replies; 5+ messages in thread
From: Christoph Haller @ 2002-11-08 08:22 UTC (permalink / raw)
To: ho@optimasoft.com.tw; +Cc: pgsql-sql
>
> if I want to write a function for getting the view.field's source
> table.field
> how could I achieve it?
>
This sounds like a real challange.
Throughout the years I've had to learn it's always a pain to
retrieve system catalog information - no matter which
DBMS is in use.
On the other hand, you have to face the fact that
view.field's sources are not necessarily directly derived
from a table.field.
A view.field's source may be any expression including aggregates.
So, the only way I can think of achieving that is
SELECT definition from pg_views where viewname='<your view name>';
and then your function has to parse the result. Good luck.
Regards, Christoph
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2002-11-08 08:22 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-11-07 09:12 how to get the source table & field name of a view field Prime Ho <ho@optimasoft.com.tw>
2002-11-07 14:25 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
2002-11-07 15:08 ` Ken Kennedy <kkennedy@kenzoid.com>
2002-11-07 14:06 Re: how to get the source table & field name of a view field Christoph Haller <ch@rodos.fzk.de>
2002-11-08 08:22 Re: how to get the source table & field name of a view field Christoph Haller <ch@rodos.fzk.de>
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