函數:string || string
說明:String concatenation 字符串連接操作
例子:'Post' || 'greSQL' = PostgreSQL
?
函數:string || non-string or non-string || string
說明:String concatenation with one non-string input 字符串與非字符串類型進行連接操作
例子:'Value: ' || 42 = Value: 42
?
函數:bit_length(string)
說明:Number of bits in string 計算字符串的位數
例子:bit_length('jose') = 32
?
函數:char_length(string) or character_length(string)
說明:Number of characters in string 計算字符串中字符個數
例子:char_length('jose') = 4
?
函數:lower(string)
說明:Convert string to lower case 轉換字符串為小寫
例子:bit_length('jose') = 32
?
函數:octet_length(string)
說明:Number of bytes in string 計算字符串的字節數
例子:octet_length('jose') = 4
函數:overlay(string placing string from int [for int])
說明:Replace substring 替換字符串中任意長度的子字串為新字符串
例子:overlay('Txxxxas' placing 'hom' from 2 for 4) = 4
函數:position(substring in string)
說明:Location of specified substring 子串在一字符串中的位置
例子:position('om' in 'Thomas') = 3
函數:substring(string [from int] [for int])
說明:Extract substring 截取任意長度的子字符串
例子:substring('Thomas' from 2 for 3) = hom
函數:substring(string from pattern)
說明:Extract substring matching POSIX regular expression. See Section 9.7 for more information on pattern matching. 利用正則表達式對一字符串進行任意長度的字串的截取
例子:substring('Thomas' from '...$') = mas
函數:substring(string from pattern for escape)
說明:Extract substring matching SQL regular expression. See Section 9.7 for more information on pattern matching. 利於正則表達式對某類字符進行刪除,以得到子字符串
例子:trim(both 'x' from 'xTomxx') = Tom
函數:trim([leading | trailing | both] [characters] from string)
說明:Remove the longest string containing only the characters (a space by default) from the start/end/both ends of the string 去除盡可能長開始,結束或者兩邊的某類字符,默認為去除空白字符,當然可以自己指定,可同時指定多個要刪除的字符串
例子:trim(both 'x' from 'xTomxx') = Tom
函數:upper(string)
說明:Convert string to uppercase 將字符串轉換為大寫
例子:upper('tom') = TOM
函數:ascii(string)
說明:ASCII code of the first character of the argument. For UTF8 returns the Unicode code point of the character. For other multibyte encodings. the argument must be a strictly ASCII character. 得到某一個字符的Assii值
例子:ascii('x') = 120
函數:btrim(string text [, characters text])
說明:Remove the longest string consisting only of characters in characters (a space by default) from the start and end of string 去除字符串兩邊的所有指定的字符,可同時指定多個字符
例子:btrim('xyxtrimyyx', 'xy') = trim
函數:chr(int)
說明:Character with the given code. For UTF8 the argument is treated as a Unicode code point. For other multibyte encodings the argument must designate a strictly ASCII character. The NULL (0) character is not allowed because text data types cannot store such bytes. 得到某ACSII值對應的字符
例子:chr(65) = A
函數:convert(string bytea, src_encoding name, dest_encoding name)
說明:Convert string to dest_encoding. The original encoding is specified by src_encoding. The string must be valid in this encoding. Conversions can be defined by CREATE CONVERSION. Also there are some predefined conversions. See Table 9-7 for available conversions. 轉換字符串編碼,指定源編碼與目標編碼
例子:convert('text_in_utf8', 'UTF8', 'LATIN1') = text_in_utf8 represented in ISO 8859-1 encoding
函數:convert_from(string bytea, src_encoding name)
說明:Convert string to the database encoding. The original encoding is specified by src_encoding. The string must be valid in this encoding. 轉換字符串編碼,自己要指定源編碼,目標編碼默認為數據庫指定編碼,
例子:convert_from('text_in_utf8', 'UTF8') = text_in_utf8 represented in the current database encoding
函數:convert_to(string text, dest_encoding name)
說明:Convert string to dest_encoding.轉換字符串編碼,源編碼默認為數據庫指定編碼,自己要指定目標編碼,
例子:convert_to('some text', 'UTF8') = some text represented in the UTF8 encoding
函數:decode(string text, type text)
說明:Decode binary data from string previously encoded with encode. Parameter type is same as in encode. 對字符串按指定的類型進行解碼
例子:decode('MTIzAAE=', 'base64') = 123\000\001
函數:encode(data bytea, type text)
說明:Encode binary data to different representation. Supported types are: base64, hex, escape. Escape merely outputs null bytes as \000 and doubles backslashes. 與decode相反,對字符串按指定類型進行編碼
例子:encode(E'123\\000\\001', 'base64') = MTIzAAE=
函數:initcap(string)
說明:Convert the first letter of each word to uppercase and the rest to lowercase. Words are sequences of alphanumeric characters separated by non-alphanumeric characters. 將字符串所有的單詞進行格式化,首字母大寫,其它為小寫
例子:initcap('hi THOMAS') = Hi Thomas
函數:length(string)
說明:Number of characters in string 講算字符串長度
例子:length('jose') = 4
函數:length(stringbytea, encoding name )
說明:Number of characters in string in the given encoding. The string must be valid in this encoding. 計算字符串長度,指定字符串使用的編碼
例子:length('jose', 'UTF8') = 4
函數:lpad(string text, length int [, fill text])
說明:Fill up the string to length length by prepending the characters fill (a space by default). If the string is already longer than length then it is truncated (on the right). 對字符串左邊進行某類字符自動填充,即不足某一長度,則在左邊自動補上指定的字符串,直至達到指定長度,可同時指定多個自動填充的字符
例子:lpad('hi', 5, 'xy') = xyxhi
函數:ltrim(string text [, characters text])
說明:Remove the longest string containing only characters from characters (a space by default) from the start of string 刪除字符串左邊某一些的字符,可以時指定多個要刪除的字符
例子:trim
函數:md5(string)
說明:Calculates the MD5 hash of string, returning the result in hexadecimal 將字符串進行md5編碼
例子:md5('abc') = 900150983cd24fb0 d6963f7d28e17f72
函數:pg_client_encoding()
說明:Current client encoding name 得到pg客戶端編碼
例子:pg_client_encoding() = SQL_ASCII
函數:quote_ident(string text)
說明:Return the given string suitably quoted to be used as an identifier in an SQL statement string. Quotes are added only if