Or even, slightly shorter:
EXECUTE
'SELECT '
|| array_to_string(ARRAY(
SELECT a.attname
FROM pg_class c, pg_namespace n, pg_attribute a
WHERE n.oid = c.relnamespace
AND a.attrelid = c.oid
AND a.attnum >= 1
AND n.nspname = 'myschema'
AND c.relname = 'mytbl'
On May 30, 7:42 am, [EMAIL PROTECTED] (PFC) wrote:
> Python example :
I found a decent solution for the existing plpgsql function (as
posted). Thanks a lot for the insight into the Python way, though!
Regards
Erwin
---(end of broadcast)--
On May 30, 6:48 am, Rodrigo De León <[EMAIL PROTECTED]> wrote:
> You might want to add:
>
> AND a.attnum >=1
>
> to remove "tableoid" and friends from the output.
Now I know why I did not get tableoid & friends: because I am querying
a view which does not yield these fields. But to be on the
On Wed, 30 May 2007 05:24:57 +0200, Erwin Brandstetter
<[EMAIL PROTECTED]> wrote:
On May 30, 2:11 am, Rodrigo De León <[EMAIL PROTECTED]> wrote:
(... useful code example snipped)
Now see:
http://www.postgresql.org/docs/8.2/static/plpgsql-control-structures
Thanks for your hints, Rodri
On May 30, 6:48 am, Rodrigo De León <[EMAIL PROTECTED]> wrote:
> On May 29, 11:35 pm, Erwin Brandstetter <[EMAIL PROTECTED]> wrote:
>
> > EXECUTE
> > 'SELECT '
> > || (SELECT array_to_string(ARRAY(
> > SELECT a.attname
> > FROM pg_class c, pg_namespace nc, pg_attribute a
> > WHERE c.relname = 'v_
On May 29, 11:35 pm, Erwin Brandstetter <[EMAIL PROTECTED]> wrote:
> EXECUTE
> 'SELECT '
> || (SELECT array_to_string(ARRAY(
> SELECT a.attname
> FROM pg_class c, pg_namespace nc, pg_attribute a
> WHERE c.relname = 'v_event'
>AND c.relnamespace = nc.oid
>AND nc.nspname = 'stdat'
>AND
To conclude (to the best of my current knowledge), here is a plpgsql
code sample based on what was said here:
EXECUTE
'SELECT '
|| (SELECT array_to_string( ARRAY(
SELECT column_name::text
FROM information_schema.columns
WHERE table_schema = 'my_schema'
AND table_name = 'my_relation'
On May 30, 2:11 am, Rodrigo De León <[EMAIL PROTECTED]> wrote:
(... useful code example snipped)
> Now see:
>
> http://www.postgresql.org/docs/8.2/static/plpgsql-control-structures
Thanks for your hints, Rodrigo!
I am aware I can consult pg_catalog / information_schema to retrieve
the informa
Rodrigo De León escribió:
> Now see:
>
> http://www.postgresql.org/docs/8.2/static/plpgsql-control-structures.html#PLPGSQL-RECORDS-ITERATING
Just a quick reminder that it's usually painful to build "generic"
functions in plpgsql because it's not prepared to deal with column or
table names built
On May 29, 5:42 pm, [EMAIL PROTECTED] wrote:
> Hi!
>
> Title says it pretty much. I am wondering if there is a short way to
> form a query that retrieves all fields of a table (of which I do not
> know names and number beforehand) except for one (or more, of which I
> know the name(s)). I have stum
Hi!
Title says it pretty much. I am wondering if there is a short way to
form a query that retrieves all fields of a table (of which I do not
know names and number beforehand) except for one (or more, of which I
know the name(s)). I have stumbled across the need for this a couple
of time during th
11 matches
Mail list logo