I have a view in my database (PostgreSQL
) and I would like to see it's code.
I wrote this query:
select definition from pg_views where viewname='x'
this works most of the time, However in some of the views when the select
code is long I get at some point (...)
for example this is one of the results of query where it shows (...)
:
" SELECT f.selectid,
a.clientid,
a.orderid,
a.clientname,
c.part,
c.product,
c.okey,
e.contry,
d.city,
(
CASE
WHEN (b.dateofissue IS NULL) THEN
CASE
(...)"
This is only part of the code... Why it doesn't show me the whole code?
You want pg_get_viewdef
, but I suspect you'll have the same issue there. The problem is probably that the client application is truncating the returned query.
If you're using PgAdmin-III this is in the FAQ.
If you're using psql
this shouldn't happen.