Re: Function to split pg_trigger.tgargs - Mailing list pgsql-hackers

From Rod Taylor
Subject Re: Function to split pg_trigger.tgargs
Date
Msg-id 019001c1b879$6b4a2760$8001a8c0@jester
Whole thread Raw
In response to Function to split pg_trigger.tgargs  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
List pgsql-hackers
http://www.zort.ca/postgresql/postgresql_autodoc_0.50.tar.gz

The below is taken from the above.
   my $args = $forcols->{'args'};   my $nargs = $forcols->{'number_args'};
   if ($nargs == 6) {     my ( $keyname        , $table        , $ftable        , $unspecified        , $lcolumn_name
    , $fcolumn_name        ) = split(/\000/, $args);
 
     $structure{$group}{$table_name}{'COLUMN'}{$lcolumn_name}{'FK'} =
"$ftable";  #.$fcolumn_name";
     # print "   FK   $lcolumn_name -> $ftable.$fcolumn_name\n";   } elsif (($nargs - 6) % 2 == 0) {     my ( $keyname
     , $table        , $ftable        , $unspecified        , $lcolumn_name        , $fcolumn_name        , @junk
) = split(/\000/, $args);
 
     my $key_cols = "$lcolumn_name";     my $ref_cols = "$fcolumn_name";
     while ($lcolumn_name = pop(@junk) and $fcolumn_name =
pop(@junk)) {
       $key_cols .= ", $lcolumn_name";       $ref_cols .= ", $fcolumn_name";     }
     $structure{$group}{$table_name}{'CONSTRAINT'}{$constraint_name}
= "FOREIGN KEY ($key_cols) REFERENCES $ftable($ref_cols)";   }
--
Rod Taylor

This message represents the official view of the voices in my head

----- Original Message -----
From: "Christopher Kings-Lynne" <chriskl@familyhealth.com.au>
To: "Hackers" <pgsql-hackers@postgresql.org>;
<pgsql-sql@postgresql.org>
Sent: Monday, February 18, 2002 12:35 AM
Subject: [HACKERS] Function to split pg_trigger.tgargs


> Hi All,
>
> Is there a function in the catalogs somewhere that will split this?:
>
> australia=# select tgargs from pg_trigger where oid=3842228;
>                                              tgargs
>
> --------------------------------------------------------------------
--------
> ------
> --------------
>
>
<unnamed>\000users_mealplans_prefs\000medidiets_meals\000UNSPECIFIED\0
00meal
> _id\0
> 00meal_id\000
> (1 row)
>
> I'm hoping to do the splitting within pl/pgsql even.  If there is no
> function to break it up, can someone please suggest how I would code
taking
> this string and breaking it into components.
>
> Chris
>
>
> ---------------------------(end of
broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to
majordomo@postgresql.org
>



pgsql-hackers by date:

Previous
From: Lee Kindness
Date:
Subject: [Fwd: Re: Errors with building PG 7.2 on Mandrake 8.0]
Next
From: "Len Morgan"
Date:
Subject: Re: [Fwd: Re: Errors with building PG 7.2 on Mandrake 8.0]