small doc patch for regexp_replace

Поиск
Список
Период
Сортировка
Искать

small doc patch for regexp_replace

От:
Joachim Wieland <joe@mcknight.de>
Дата:
Вложения:
Is there any reason, why regexp_replace is not included in the tables of the
string functions?

http://developer.postgresql.org/docs/postgres/functions-string.html

The appended patch adds regexp_replace() and links to the pattern matching
section for substring / regexp_replace.

I noticed that in the table the declaration of the arguments is
inconsistent, for example:

lower(string)
ascii(text)
length(string text)

also in the sgml, there is sometimes "text" and sometimes
"text".

I'd fix that if someone told me what the preferred (if any) form is...


Joachim

Re: small doc patch for regexp_replace

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
Joachim Wieland wrote:
> Is there any reason, why regexp_replace is not included in the tables of the
> string functions?
> 
> http://developer.postgresql.org/docs/postgres/functions-string.html
> 
> The appended patch adds regexp_replace() and links to the pattern matching
> section for substring / regexp_replace.
> 
> I noticed that in the table the declaration of the arguments is
> inconsistent, for example:
> 
> lower(string)
> ascii(text)
> length(string text)
> 
> also in the sgml, there is sometimes "text" and sometimes
> "text".
> 
> I'd fix that if someone told me what the preferred (if any) form is...

Seems there is some inconsistency there.  There are two types of
function listings, one with just the types, and another with param_name
and then type.  We use "string" instead of "text" because varchar() and
char() can also be used.

Anyway, applied patch attached that tries to clean it up.  Let me know
if you find others.

-- 
  Bruce Momjian   http://candle.pha.pa.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: func.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/func.sgml,v
retrieving revision 1.316
retrieving revision 1.317
diff -c -r1.316 -r1.317
*** func.sgml	30 Apr 2006 21:15:32 -0000	1.316
--- func.sgml	18 May 2006 00:50:08 -0000	1.317
***************
*** 1,4 ****
! 
  
   
    Functions and Operators
--- 1,4 ----
! 
  
   
    Functions and Operators
***************
*** 1244,1250 ****
  
       
        
!        ascii(text)
         int
         ASCII code of the first byte of the argument
         ascii('x')
--- 1244,1250 ----
  
       
        
!        ascii(string)
         int
         ASCII code of the first byte of the argument
         ascii('x')
***************
*** 1274,1281 ****
  
        
         
!         convert(string
!         text,
          src_encoding name,
          dest_encoding name)
         
--- 1274,1280 ----
  
        
         
!         convert(string text,
          src_encoding name,
          dest_encoding name)
         
***************
*** 1320,1326 ****
               
  
        
!        initcap(text)
         text
         
          Convert the first letter of each word to uppercase and the
--- 1319,1325 ----
               
  
        
!        initcap(string)
         text
         
          Convert the first letter of each word to uppercase and the
***************
*** 1332,1338 ****
        
  
        
!        length(string text)
         int
         
          Number of characters in string
--- 1331,1337 ----
        
  
        
!        length(string)
         int
         
          Number of characters in string
***************
*** 1375,1381 ****
        
  
        
!        md5(string text)
         text
         
          Calculates the MD5 hash of string,
--- 1374,1380 ----
        
  
        
!        md5(string)
         text
         
          Calculates the MD5 hash of string,
***************
*** 1396,1402 ****
        
  
        
!        quote_ident(string text)
         text
         
          Return the given string suitably quoted to be used as an identifier
--- 1395,1401 ----
        
  
        
!        quote_ident(string)
         text
         
          Return the given string suitably quoted to be used as an identifier
***************
*** 1410,1416 ****
        
  
        
!        quote_literal(string text)
         text
         
          Return the given string suitably quoted to be used as a string literal
--- 1409,1415 ----
        
  
        
!        quote_literal(string)
         text
         
          Return the given string suitably quoted to be used as a string literal
***************
*** 1511,1522 ****
        
  
        
!        to_ascii(text
!         , encoding)
         text
  
         
!        Convert text to ASCII from another encoding
         
          
           The to_ascii function supports conversion from
--- 1510,1521 ----
        
  
        
!        to_ascii(string text
!         , encoding text)
         text
  
         
!        Convert string to ASCII from another encoding
         
          
           The to_ascii function supports conversion from
***************
*** 1543,1550 ****
  
        
         
!         translate(string
!         text,
          from text,
          to text)
         
--- 1542,1548 ----
  
        
         
!         translate(string text,
          from text,
          to text)
         

Re: small doc patch for regexp_replace

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Bruce Momjian  writes:
> Seems there is some inconsistency there.  There are two types of
> function listings, one with just the types, and another with param_name
> and then type.  We use "string" instead of "text" because varchar() and
> char() can also be used.

Where did that come from?  The actual functions generally take "text",
relying on implicit conversions to handle the other types.  Since we do
not have any type named "string", I think the locution string</>
is a contradiction in terms.

IMHO these should all go back to text</>.

			regards, tom lane

Re: small doc patch for regexp_replace

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
Tom Lane wrote:
> Bruce Momjian  writes:
> > Seems there is some inconsistency there.  There are two types of
> > function listings, one with just the types, and another with param_name
> > and then type.  We use "string" instead of "text" because varchar() and
> > char() can also be used.
> 
> Where did that come from?  The actual functions generally take "text",
> relying on implicit conversions to handle the other types.  Since we do
> not have any type named "string", I think the locution string</>
> is a contradiction in terms.
> 
> IMHO these should all go back to text</>.

Well, we actually have string</> and I got a few wrong.  I
have committed the changes.	If we want to use text</> instead
of string</>, I can make that change too.  There are quite a
few of them, like md5().  Yes?

-- 
  Bruce Momjian   http://candle.pha.pa.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

Re: small doc patch for regexp_replace

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:

Patch applied.  Thanks.  Your documentation changes can be viewed in
five minutes using links on the developer's page,
http://www.postgresql.org/developer/testing.


---------------------------------------------------------------------------


Joachim Wieland wrote:
> Is there any reason, why regexp_replace is not included in the tables of the
> string functions?
> 
> http://developer.postgresql.org/docs/postgres/functions-string.html
> 
> The appended patch adds regexp_replace() and links to the pattern matching
> section for substring / regexp_replace.
> 
> I noticed that in the table the declaration of the arguments is
> inconsistent, for example:
> 
> lower(string)
> ascii(text)
> length(string text)
> 
> also in the sgml, there is sometimes "text" and sometimes
> "text".
> 
> I'd fix that if someone told me what the preferred (if any) form is...
> 
> 
> Joachim

[ Attachment, skipping... ]

> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings

-- 
  Bruce Momjian   http://candle.pha.pa.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
FAQ