Uploaded image for project: 'Tajo (Retired)'
  1. Tajo (Retired)
  2. TAJO-341

Implement substr function

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 0.8.0
    • Function/UDF
    • None

    Description

      Function Definition

      text substr(string text, from int4 [, count int4])
      

      Description

      • It extracts substring (same as substring(string from from for count)).
      • If string is null, the result also should be null.
      • Note that from is one based index.
      • from can be negative integer.
      • count can be omitted. If then, all string after from will be returned.
      • count cannot be negative integer.
      • If count is 0, the result should be '' instead of null.

      Example and Sementic

      hyunsik=> select substr('abcdef', 3, 2);
       substr 
      --------
      cd
      
      (1 row)
      
      hyunsik=> select substr('abcdef',3) ;
       substr 
      --------
       cdef
      (1 row)
      
      hyunsik=> select substr('abcdef',1,1) ;
       substr 
      --------
       a
      
      (1 row)
      hyunsik=> select substr('abcdef',0,1) ;
       substr 
      --------
       
      (1 row)
      
      hyunsik=> select substr('abcdef',0,2) ;
       substr 
      --------
       a
      (1 row)
      
      

      Attachments

        1. TAJO-341.patch
          6 kB
          Hyoungjun Kim

        Issue Links

          Activity

            People

              hjkim Hyoungjun Kim
              hyunsik Hyunsik Choi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: