From: | "Rod Taylor" <rbt(at)zort(dot)ca> |
---|---|
To: | "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>, "Hackers" <pgsql-hackers(at)postgresql(dot)org>, <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Function to split pg_trigger.tgargs |
Date: | 2002-02-18 12:40:16 |
Message-ID: | 019001c1b879$6b4a2760$8001a8c0@jester |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-sql |
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(at)familyhealth(dot)com(dot)au>
To: "Hackers" <pgsql-hackers(at)postgresql(dot)org>;
<pgsql-sql(at)postgresql(dot)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(at)postgresql(dot)org
>
From | Date | Subject | |
---|---|---|---|
Next Message | Len Morgan | 2002-02-18 13:09:57 | Re: [Fwd: Re: Errors with building PG 7.2 on Mandrake 8.0] |
Previous Message | Lee Kindness | 2002-02-18 11:10:24 | [Fwd: Re: Errors with building PG 7.2 on Mandrake 8.0] |
From | Date | Subject | |
---|---|---|---|
Next Message | Mikey | 2002-02-18 12:43:00 | SQL: Are the "" around table & coloumnames necessary? |
Previous Message | Luis Sousa | 2002-02-18 12:10:00 | Sequence in the rules |