pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
plsql.sgml patch
3+ messages / 3 participants
[nested] [flat]

* plsql.sgml patch
@ 2001-03-23 14:35 Roberto Mello <rmello@cc.usu.edu>
  2001-03-23 22:08 ` Re: plsql.sgml patch Tom Lane <tgl@sss.pgh.pa.us>
  2001-03-24 10:53 ` Re: plsql.sgml patch Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 2 replies; 3+ messages in thread

From: Roberto Mello @ 2001-03-23 14:35 UTC (permalink / raw)
  To: pgsql-docs

	I sent a patch to plsql.sgml to Peter a four days ago and the
message is bouncing, so I am sending this to the list. The patch corrects 
a bug in my instr function and has the third instr function in PL/pgSQL 
instead of PL/Tcl.
	
	Thanks,

	-Roberto

----- Forwarded message from Mail Delivery Subsystem <MAILER-DAEMON> -----

From: Mail Delivery Subsystem <MAILER-DAEMON>
To: roberto
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)

The original message was received at Mon, 19 Mar 2001 17:55:20 -0700
from roberto@localhost

   ----- The following addresses had permanent fatal errors -----
peter_e@gmx.net
    (reason: 451 4.4.1 peter_e@gmx.net... reply: read error from mx0.gmx.de.)

   ----- Transcript of session follows -----
451 4.0.0 readauth: cannot open /etc/mail/auth-info: No such file or directory
451 4.0.0 readauth: cannot open /etc/mail/auth-info: No such file or directory
451 4.0.0 readauth: cannot open /etc/mail/auth-info: No such file or directory
... while talking to mx0.gmx.net.:
>>> QGJyYXNpbGVpcm8ubmV0IDVjY2EyMzBlZGU5NTY1ZGI2NDkzNmZhZjVkNTgwNGJl
<<< 535 {mx25} auth failure
451 4.0.0 readauth: cannot open /etc/mail/auth-info: No such file or directory
451 4.0.0 readauth: cannot open /etc/mail/auth-info: No such file or directory
>>> AUTH PLAIN AEBicmFzaWxlaXJvLm5ldAA=
<<< 535 {mx25} auth failure
451 4.0.0 readauth: cannot open /etc/mail/auth-info: No such file or directory
451 4.4.1 peter_e@gmx.net... reply: read error from mx0.gmx.net.
451 4.0.0 readauth: cannot open /etc/mail/auth-info: No such file or directory
... while talking to mx0.gmx.de.:
>>> QGJyYXNpbGVpcm8ubmV0IDQ0ZmUxY2NhYjZkMWM5M2EwYTY1ZGYzYzI3ODRkMjNm
<<< 535 {mx13} auth failure
>>> AUTH PLAIN AEBicmFzaWxlaXJvLm5ldAA=
<<< 535 {mx13} auth failure
451 4.0.0 readauth: cannot open /etc/mail/auth-info: No such file or directory
451 4.4.1 peter_e@gmx.net... reply: read error from mx0.gmx.de.
peter_e@gmx.net... Deferred: Connection reset by mx0.gmx.de.
Message could not be delivered for zero seconds
Message will be deleted from queue

Reporting-MTA: dns; brasileiro.net
Arrival-Date: Mon, 19 Mar 2001 17:55:20 -0700

Final-Recipient: RFC822; peter_e@gmx.net
Action: failed
Status: 4.4.7
Diagnostic-Code: SMTP; 451 4.4.1 peter_e@gmx.net... reply: read error from mx0.gmx.de.
Last-Attempt-Date: Mon, 19 Mar 2001 17:55:45 -0700

From: Roberto Mello <rmello@cc.usu.edu>
To: Peter Eisentraut <peter_e@gmx.net>
Subject: Patch to plsql.sgml

	Hi Peter,

	Robert Gaszewski made some modifications to my instr functions,
including porting the last function
(instr(varchar,varchar,integer,integer)) to PL/pgSQL (instead of PL/Tcl).
He also found a small bug on my first PG/pgSQL port of instr.

	I am attaching a patch, made against the current plsql.sgml from CVS.

	Thanks,

	-Roberto
----- End forwarded message -----

-- 
Computer Science			Utah State University
Space Dynamics Laboratory		Web Developer
USU Free Software & GNU/Linux Club 	http://fslc.usu.edu
My home page - http://www.brasileiro.net/roberto

Attachments:

instr-plsql.diff (text/plain, 6.6K) download *** plsql-orig.sgml Mon Mar 19 17:21:26 2001 --- plsql-new.sgml Mon Mar 19 17:39:20 2001 *************** WITH (isstrict, iscachable); *** 2426,2427 **** --- 2426,2428 ---- -- by Roberto Mello (rmello@fslc.usu.edu) + -- modified by Robert Gaszewski <graszew@poland.com> -- Licensed under the GPL v2 or later. *************** WITH (isstrict, iscachable); *** 2429,2432 **** ! DROP FUNCTION instr(varchar, varchar); ! CREATE FUNCTION instr(varchar, varchar) RETURNS integer AS ' DECLARE --- 2430,2433 ---- ! DROP FUNCTION instr(varchar,varchar); ! CREATE FUNCTION instr(varchar,varchar) RETURNS integer AS ' DECLARE *************** DECLARE *** 2434,2442 **** BEGIN ! pos:= instr($1, $2, 1); RETURN pos; END; ! ' LANGUAGE 'plpgsql'; ! DROP FUNCTION instr(varchar, varchar, integer); ! CREATE FUNCTION instr(varchar, varchar, integer) RETURNS integer AS ' DECLARE --- 2435,2491 ---- BEGIN ! pos:= instr($1,$2,1); RETURN pos; END; ! ' language 'plpgsql'; ! ! DROP FUNCTION instr(varchar,varchar,integer); ! CREATE FUNCTION instr(varchar,varchar,integer) RETURNS integer AS ' ! DECLARE ! string ALIAS FOR $1; ! string_to_search ALIAS FOR $2; ! beg_index ALIAS FOR $3; ! pos integer NOT NULL DEFAULT 0; ! temp_str varchar; ! beg integer; ! length integer; ! ss_length integer; ! BEGIN ! IF beg_index > 0 THEN ! ! temp_str := substring(string FROM beg_index); ! pos := position(string_to_search IN temp_str); ! ! IF pos = 0 THEN ! RETURN 0; ! ELSE ! RETURN pos + beg_index - 1; ! END IF; ! ELSE ! ss_length := char_length(string_to_search); ! length := char_length(string); ! beg := length + beg_index - ss_length + 2; ! ! WHILE beg > 0 LOOP ! ! temp_str := substring(string FROM beg FOR ss_length); ! pos := position(string_to_search IN temp_str); ! ! IF pos > 0 THEN ! RETURN beg; ! END IF; ! ! beg := beg - 1; ! END LOOP; ! RETURN 0; ! END IF; ! END; ! ' language 'plpgsql'; ! ! -- ! -- Written by Robert Gaszewski (graszew@poland.com) ! -- Licensed under the GPL v2 or later. ! -- ! DROP FUNCTION instr(varchar,varchar,integer,integer); ! CREATE FUNCTION instr(varchar,varchar,integer,integer) RETURNS integer AS ' DECLARE *************** DECLARE *** 2445,2458 **** beg_index ALIAS FOR $3; pos integer NOT NULL DEFAULT 0; ! ending integer; temp_str varchar; beg integer; length integer; ! temp_int integer; BEGIN IF beg_index > 0 THEN ! -- Get substring from 1 to beg_index ! temp_str := substring(string FROM beg_index); ! pos := position(string_to_search IN temp_str); --- 2494,2519 ---- beg_index ALIAS FOR $3; + occur_index ALIAS FOR $4; pos integer NOT NULL DEFAULT 0; ! occur_number integer NOT NULL DEFAULT 0; temp_str varchar; beg integer; + i integer; length integer; ! ss_length integer; BEGIN IF beg_index > 0 THEN ! beg := beg_index; ! temp_str := substring(string FROM beg_index); ! FOR i IN 1..occur_index LOOP ! pos := position(string_to_search IN temp_str); ! ! IF i = 1 THEN ! beg := beg + pos - 1; ! ELSE ! beg := beg + pos; ! END IF; ! ! temp_str := substring(string FROM beg + 1); ! END LOOP; *************** BEGIN *** 2461,2548 **** ELSE ! RETURN pos + beg_index - 1; END IF; - ELSE length := char_length(string); ! IF beg_index = -1 THEN ! ending := length; ! beg := ending; ! temp_int := 1; ! ELSE ! ending := length - abs(beg_index); ! beg := ending; ! temp_int := ending - beg; ! END IF; ! ! WHILE pos = 0 AND beg &lt;&gt; 1 LOOP ! ! temp_str := substring(string FROM beg FOR temp_int); pos := position(string_to_search IN temp_str); ! -- Keep moving left beg := beg - 1; - temp_int := (ending - beg) + 1; END LOOP; - END IF; - IF pos = 0 THEN RETURN 0; - ELSE - RETURN beg + 1; END IF; END; ! ' LANGUAGE 'plpgsql'; ! ! -- ! -- The next one (where all four params are passed) is in PL/Tcl ! -- because I had no more patience to do it in PL/pgSQL. ! -- It'd probably be faster in PL/pgSQL (that being the reason why ! -- I implemented the first two functions in PL/pgSQL) so someday I'll do it. ! -- ! ! DROP FUNCTION instr(varchar, varchar, integer, integer); ! CREATE FUNCTION instr(varchar, varchar, integer, integer) RETURNS integer AS ' ! set string1 $1 ! set string2 $2 ! set n $3 ! set m $4 ! ! if { $n > 0 } { ! set pos [string first $string2 $string1 [expr $n -1]] ! if { $pos < 0 } { ! return 0 ! } else { ! for { set i 1 } { $i < $m } { incr i } { ! set pos [string first $string2 $string1 [expr $pos + 1]] ! if { $pos < 0 } { ! return 0 ! } ! } ! } ! } ! ! if { $n < 0 } { ! set pos [string last $string2 $string1 [expr [string length $string1] + $n]] ! ! if { $pos < 0 } { ! return 0 ! } else { ! for { set i 1 } { $i < $m } { incr i } { ! # n is negative so we add ! set pos [string last $string2 $string1 [expr $pos - 1]] ! if { $pos < 0 } { ! return 0 ! } ! } ! } ! } ! ! if { $pos < 0 } { ! return 0 ! } else { ! return [expr $pos + 1] ! } ! ' LANGUAGE 'pltcl'; </programlisting> --- 2522,2549 ---- ELSE ! RETURN beg; END IF; ELSE + ss_length := char_length(string_to_search); length := char_length(string); + beg := length + beg_index - ss_length + 2; ! WHILE beg > 0 LOOP ! temp_str := substring(string FROM beg FOR ss_length); pos := position(string_to_search IN temp_str); ! IF pos > 0 THEN ! occur_number := occur_number + 1; ! ! IF occur_number = occur_index THEN ! RETURN beg; ! END IF; ! END IF; beg := beg - 1; END LOOP; RETURN 0; END IF; END; ! ' language 'plpgsql'; </programlisting>
^ permalink raw reply [nested|flat] 3+ messages in thread

* Re: plsql.sgml patch
  2001-03-23 14:35 plsql.sgml patch Roberto Mello <rmello@cc.usu.edu>
@ 2001-03-23 22:08 ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2001-03-23 22:08 UTC (permalink / raw)
  To: Roberto Mello <rmello@cc.usu.edu>; +Cc: pgsql-docs

Roberto Mello <rmello@cc.usu.edu> writes:
> 	I sent a patch to plsql.sgml to Peter a four days ago and the
> message is bouncing, so I am sending this to the list. The patch corrects 
> a bug in my instr function and has the third instr function in PL/pgSQL 
> instead of PL/Tcl.

Applied.  Thanks.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: plsql.sgml patch
  2001-03-23 14:35 plsql.sgml patch Roberto Mello <rmello@cc.usu.edu>
@ 2001-03-24 10:53 ` Peter Eisentraut <peter_e@gmx.net>
  1 sibling, 0 replies; 3+ messages in thread

From: Peter Eisentraut @ 2001-03-24 10:53 UTC (permalink / raw)
  To: Roberto Mello <rmello@cc.usu.edu>; +Cc: pgsql-docs

Roberto Mello writes:

> 	I sent a patch to plsql.sgml to Peter a four days ago and the
> message is bouncing,

Funny.  Anyone else getting this?

> so I am sending this to the list.

That's better anyway.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2001-03-24 10:53 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-03-23 14:35 plsql.sgml patch Roberto Mello <rmello@cc.usu.edu>
2001-03-23 22:08 ` Tom Lane <tgl@sss.pgh.pa.us>
2001-03-24 10:53 ` Peter Eisentraut <peter_e@gmx.net>

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