Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
5e84d58e
Commit
5e84d58e
authored
Jun 14, 1999
by
Thomas G. Lockhart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor updates for release.
parent
abc40591
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
851 additions
and
819 deletions
+851
-819
doc/src/sgml/datatype.sgml
doc/src/sgml/datatype.sgml
+1
-1
doc/src/sgml/docguide.sgml
doc/src/sgml/docguide.sgml
+5
-2
doc/src/sgml/func.sgml
doc/src/sgml/func.sgml
+682
-680
doc/src/sgml/lobj.sgml
doc/src/sgml/lobj.sgml
+155
-130
doc/src/sgml/release.sgml
doc/src/sgml/release.sgml
+8
-6
No files found.
doc/src/sgml/datatype.sgml
View file @
5e84d58e
<chapter id="datatype">
<chapter id="datatype">
<title>Data Types</title>
<title
id="datatype-title"
>Data Types</title>
<abstract>
<abstract>
<para>
<para>
...
...
doc/src/sgml/docguide.sgml
View file @
5e84d58e
<!--
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/docguide.sgml,v 1.1
5 1999/05/27 15:49:07
thomas Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/docguide.sgml,v 1.1
6 1999/06/14 07:36:11
thomas Exp $
Documentation Guide
Documentation Guide
Thomas Lockhart
Thomas Lockhart
$Log: docguide.sgml,v $
$Log: docguide.sgml,v $
Revision 1.16 1999/06/14 07:36:11 thomas
Minor updates for release.
Revision 1.15 1999/05/27 15:49:07 thomas
Revision 1.15 1999/05/27 15:49:07 thomas
Markup fixes.
Markup fixes.
Update for v6.5 release.
Update for v6.5 release.
...
@@ -175,7 +178,7 @@ Include working list of all documentation sources, with current status
...
@@ -175,7 +178,7 @@ Include working list of all documentation sources, with current status
James Clark's
James Clark's
<ulink url="http://www.jclark.com/jade/"> <productname>jade</productname></ulink>
<ulink url="http://www.jclark.com/jade/"> <productname>jade</productname></ulink>
and Norm Walsh's
and Norm Walsh's
<ulink url="http://www.
berkshire.net/~norm/docbook/dsssl
">Modular DocBook Stylesheets</ulink>.
<ulink url="http://www.
nwalsh.com/docbook/dsssl/
">Modular DocBook Stylesheets</ulink>.
</para>
</para>
<para>
<para>
...
...
doc/src/sgml/func.sgml
View file @
5e84d58e
<
Chapter I
d="functions">
<
chapter i
d="functions">
<
Title id="functions-title">Functions</T
itle>
<
title id="functions-title">Functions</t
itle>
<Abstract>
<abstract>
<Para>
<para>
Describes the built-in functions available in <ProductName>Postgres</ProductName>.
Describes the built-in functions available
</Para>
in <productname>Postgres</productname>.
</Abstract>
</para>
</abstract>
<
P
ara>
<
p
ara>
Many data types have functions available for conversion to other related types.
Many data types have functions available for conversion to other related types.
In addition, there are some type-specific functions. Some functions are also
In addition, there are some type-specific functions. Some functions are also
available through operators and may be documented as operators only.
available through operators and may be documented as operators only.
</
P
ara>
</
p
ara>
<sect1>
<sect1>
<title id="sql-funcs">SQL Functions</title>
<title id="sql-funcs">SQL Functions</title>
...
@@ -24,37 +25,37 @@
...
@@ -24,37 +25,37 @@
</para>
</para>
<para>
<para>
<
TABLE TOCENTRY
="1">
<
table tocentry
="1">
<
TITLE>SQL Functions</TITLE
>
<
title>SQL Functions</title
>
<
TGROUP COLS
="4">
<
tgroup cols
="4">
<
THEAD
>
<
thead
>
<
ROW
>
<
row
>
<
ENTRY>Function</ENTRY
>
<
entry>Function</entry
>
<
ENTRY>Returns</ENTRY
>
<
entry>Returns</entry
>
<
ENTRY>Description</ENTRY
>
<
entry>Description</entry
>
<
ENTRY>Example</ENTRY
>
<
entry>Example</entry
>
</
ROW
>
</
row
>
</
THEAD
>
</
thead
>
<
TBODY
>
<
tbody
>
<
ROW
>
<
row
>
<
ENTRY> COALESCE(<replaceable class="parameter">list</replaceable>) </ENTRY
>
<
entry> COALESCE(<replaceable class="parameter">list</replaceable>) </entry
>
<
ENTRY> non-NULL </ENTRY
>
<
entry> non-NULL </entry
>
<
ENTRY> return first non-NULL value in list </ENTRY
>
<
entry> return first non-NULL value in list </entry
>
<
ENTRY> COALESCE(<replaceable class="parameter">c1</replaceable>, <replaceable class="parameter">c2</replaceable> + 5, 0) </ENTRY>
<
entry> COALESCE(<replaceable class="parameter">r"</replaceable>le>, <replaceable
</ROW
>
class="parameter">c2</replaceable> + 5, 0) </entry
>
<
ROW
>
<
/row
>
<ENTRY> IFNULL(<replaceable
<row>
class="parameter">input</replaceable>,<replaceable> class="parameter">non-NULL substitute</replaceable>) </ENTRY
>
<entry> IFNULL(<replaceable class="parameter">input</replaceable>,<replaceable class="parameter">non-NULL substitute</replaceable>) </entry
>
<
ENTRY> non-NULL </ENTRY
>
<
entry> non-NULL </entry
>
<
ENTRY> return second argument if first is NULL </ENTRY
>
<
entry> return second argument if first is NULL </entry
>
<
ENTRY> IFNULL(<replaceable class="parameter">c1</replaceable>, 'N/A')</ENTRY
>
<
entry> IFNULL(<replaceable class="parameter">c1</replaceable>, 'N/A')</entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> CASE(WHEN <replaceable class="parameter">expr</replaceable> THEN <replaceable class="parameter">expr</replaceable> [...] ELSE <replaceable class="parameter">expr</replaceable> ) </ENTRY
>
<
entry> CASE WHEN <replaceable class="parameter">expr</replaceable> THEN <replaceable class="parameter">expr</replaceable> [...] ELSE <replaceable class="parameter">expr</replaceable> END </entry
>
<
ENTRY> <replaceable class="parameter">expr</replaceable> </ENTRY
>
<
entry> <replaceable class="parameter">expr</replaceable> </entry
>
<
ENTRY> return expression for first true clause </ENTRY
>
<
entry> return expression for first true clause </entry
>
<
ENTRY> CASE(WHEN <replaceable class="parameter">c1</replaceable> = 1 THEN 'match' ELSE 'no match') </ENTRY
>
<
entry> CASE WHEN <replaceable class="parameter">c1</replaceable> = 1 THEN 'match' ELSE 'no match' END </entry
>
</
ROW
>
</
row
>
</tbody>
</tbody>
</tgroup>
</tgroup>
</table>
</table>
...
@@ -64,237 +65,237 @@
...
@@ -64,237 +65,237 @@
<sect1>
<sect1>
<title id="math-funcs">Mathematical Functions</title>
<title id="math-funcs">Mathematical Functions</title>
<
P
ara>
<
p
ara>
<
TABLE TOCENTRY
="1">
<
table tocentry
="1">
<
TITLE>Mathematical Functions</TITLE
>
<
title>Mathematical Functions</title
>
<
TGROUP COLS
="4">
<
tgroup cols
="4">
<
THEAD
>
<
thead
>
<
ROW
>
<
row
>
<
ENTRY>Function</ENTRY
>
<
entry>Function</entry
>
<
ENTRY>Returns</ENTRY
>
<
entry>Returns</entry
>
<
ENTRY>Description</ENTRY
>
<
entry>Description</entry
>
<
ENTRY>Example</ENTRY
>
<
entry>Example</entry
>
</
ROW
>
</
row
>
</
THEAD
>
</
thead
>
<
TBODY
>
<
tbody
>
<
ROW
>
<
row
>
<
ENTRY> dexp(float8) </ENTRY
>
<
entry> dexp(float8) </entry
>
<
ENTRY> float8 </ENTRY
>
<
entry> float8 </entry
>
<
ENTRY> raise e to the specified exponent </ENTRY
>
<
entry> raise e to the specified exponent </entry
>
<
ENTRY> dexp(2.0) </ENTRY
>
<
entry> dexp(2.0) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> dpow(float8,float8) </ENTRY
>
<
entry> dpow(float8,float8) </entry
>
<
ENTRY> float8 </ENTRY
>
<
entry> float8 </entry
>
<
ENTRY> raise a number to the specified exponent </ENTRY
>
<
entry> raise a number to the specified exponent </entry
>
<
ENTRY> dpow(2.0, 16.0) </ENTRY
>
<
entry> dpow(2.0, 16.0) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> float(int) </ENTRY
>
<
entry> float(int) </entry
>
<
ENTRY> float8 </ENTRY
>
<
entry> float8 </entry
>
<
ENTRY> convert integer to floating point </ENTRY
>
<
entry> convert integer to floating point </entry
>
<
ENTRY> float(2) </ENTRY
>
<
entry> float(2) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> float4(int) </ENTRY
>
<
entry> float4(int) </entry
>
<
ENTRY> float4 </ENTRY
>
<
entry> float4 </entry
>
<
ENTRY> convert integer to floating point </ENTRY
>
<
entry> convert integer to floating point </entry
>
<
ENTRY> float4(2) </ENTRY
>
<
entry> float4(2) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> integer(float) </ENTRY
>
<
entry> integer(float) </entry
>
<
ENTRY> int </ENTRY
>
<
entry> int </entry
>
<
ENTRY> convert floating point to integer </ENTRY
>
<
entry> convert floating point to integer </entry
>
<
ENTRY> integer(2.0) </ENTRY
>
<
entry> integer(2.0) </entry
>
</
ROW
>
</
row
>
</
TBODY
>
</
tbody
>
</
TGROUP
>
</
tgroup
>
</
TABLE
>
</
table
>
</
P
ara>
</
p
ara>
</sect1>
</sect1>
<sect1>
<sect1>
<title>String Functions</title>
<title>String Functions</title>
<
P
ara>
<
p
ara>
SQL92 defines string functions with specific syntax. Some of these
SQL92 defines string functions with specific syntax. Some of these
are implemented using other <
ProductName>Postgres</ProductN
ame> functions.
are implemented using other <
productname>Postgres</productn
ame> functions.
The supported string types for <acronym>SQL92</acronym> are
The supported string types for <acronym>SQL92</acronym> are
<type>char</type>, <type>varchar</type>, and <type>text</type>.
<type>char</type>, <type>varchar</type>, and <type>text</type>.
</
P
ara>
</
p
ara>
<
P
ara>
<
p
ara>
<
TABLE TOCENTRY
="1">
<
table tocentry
="1">
<
TITLE><Acronym>SQL92</Acronym> String Functions</TITLE
>
<
title><acronym>SQL92</acronym> String Functions</title
>
<
TGROUP COLS
="4">
<
tgroup cols
="4">
<
THEAD
>
<
thead
>
<
ROW
>
<
row
>
<
ENTRY>Function</ENTRY
>
<
entry>Function</entry
>
<
ENTRY>Returns</ENTRY
>
<
entry>Returns</entry
>
<
ENTRY>Description</ENTRY
>
<
entry>Description</entry
>
<
ENTRY>Example</ENTRY
>
<
entry>Example</entry
>
</
ROW
>
</
row
>
</
THEAD
>
</
thead
>
<
TBODY
>
<
tbody
>
<
ROW
>
<
row
>
<
ENTRY> char_length(string) </ENTRY
>
<
entry> char_length(string) </entry
>
<
ENTRY> int4 </ENTRY
>
<
entry> int4 </entry
>
<
ENTRY> length of string </ENTRY
>
<
entry> length of string </entry
>
<
ENTRY> char_length('jose') </ENTRY
>
<
entry> char_length('jose') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> character_length(string) </ENTRY
>
<
entry> character_length(string) </entry
>
<
ENTRY> int4 </ENTRY
>
<
entry> int4 </entry
>
<
ENTRY> length of string </ENTRY
>
<
entry> length of string </entry
>
<
ENTRY> char_length('jose') </ENTRY
>
<
entry> char_length('jose') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> lower(string) </ENTRY
>
<
entry> lower(string) </entry
>
<
ENTRY> string </ENTRY
>
<
entry> string </entry
>
<
ENTRY> convert string to lower case </ENTRY
>
<
entry> convert string to lower case </entry
>
<
ENTRY> lower('TOM') </ENTRY
>
<
entry> lower('TOM') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> octet_length(string) </ENTRY
>
<
entry> octet_length(string) </entry
>
<
ENTRY> int4 </ENTRY
>
<
entry> int4 </entry
>
<
ENTRY> storage length of string </ENTRY
>
<
entry> storage length of string </entry
>
<
ENTRY> octet_length('jose') </ENTRY
>
<
entry> octet_length('jose') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> position(string in string) </ENTRY
>
<
entry> position(string in string) </entry
>
<
ENTRY> int4 </ENTRY
>
<
entry> int4 </entry
>
<
ENTRY> location of specified substring </ENTRY
>
<
entry> location of specified substring </entry
>
<
ENTRY> position('o' in 'Tom') </ENTRY
>
<
entry> position('o' in 'Tom') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> substring(string [from int] [for int]) </ENTRY
>
<
entry> substring(string [from int] [for int]) </entry
>
<
ENTRY> string </ENTRY
>
<
entry> string </entry
>
<
ENTRY> extract specified substring </ENTRY
>
<
entry> extract specified substring </entry
>
<
ENTRY> substring('Tom' from 2 for 2) </ENTRY
>
<
entry> substring('Tom' from 2 for 2) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> trim([leading|trailing|both] [string] from string) </ENTRY
>
<
entry> trim([leading|trailing|both] [string] from string) </entry
>
<
ENTRY> string </ENTRY
>
<
entry> string </entry
>
<
ENTRY> trim characters from string </ENTRY
>
<
entry> trim characters from string </entry
>
<
ENTRY> trim(both 'x' from 'xTomx') </ENTRY
>
<
entry> trim(both 'x' from 'xTomx') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> upper(text) </ENTRY
>
<
entry> upper(text) </entry
>
<
ENTRY> text </ENTRY
>
<
entry> text </entry
>
<
ENTRY> convert text to upper case </ENTRY
>
<
entry> convert text to upper case </entry
>
<
ENTRY> upper('tom') </ENTRY
>
<
entry> upper('tom') </entry
>
</
ROW
>
</
row
>
</
TBODY
>
</
tbody
>
</
TGROUP
>
</
tgroup
>
</
TABLE
>
</
table
>
</
P
ara>
</
p
ara>
<
P
ara>
<
p
ara>
Many additional string functions are available for text, varchar(), and char() types.
Many additional string functions are available for text, varchar(), and char() types.
Some are used internally to implement the SQL92 string functions listed above.
Some are used internally to implement the SQL92 string functions listed above.
</
P
ara>
</
p
ara>
<
P
ara>
<
p
ara>
<
TABLE TOCENTRY
="1">
<
table tocentry
="1">
<
TITLE>String Functions</TITLE
>
<
title>String Functions</title
>
<
TGROUP COLS
="4">
<
tgroup cols
="4">
<
THEAD
>
<
thead
>
<
ROW
>
<
row
>
<
ENTRY>Function</ENTRY
>
<
entry>Function</entry
>
<
ENTRY>Returns</ENTRY
>
<
entry>Returns</entry
>
<
ENTRY>Description</ENTRY
>
<
entry>Description</entry
>
<
ENTRY>Example</ENTRY
>
<
entry>Example</entry
>
</
ROW
>
</
row
>
</
THEAD
>
</
thead
>
<
TBODY
>
<
tbody
>
<
ROW
>
<
row
>
<
ENTRY> char(text) </ENTRY
>
<
entry> char(text) </entry
>
<
ENTRY> char </ENTRY
>
<
entry> char </entry
>
<
ENTRY> convert text to char type </ENTRY
>
<
entry> convert text to char type </entry
>
<
ENTRY> char('text string') </ENTRY
>
<
entry> char('text string') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> char(varchar) </ENTRY
>
<
entry> char(varchar) </entry
>
<
ENTRY> char </ENTRY
>
<
entry> char </entry
>
<
ENTRY> convert varchar to char type </ENTRY
>
<
entry> convert varchar to char type </entry
>
<
ENTRY> char(varchar 'varchar string') </ENTRY
>
<
entry> char(varchar 'varchar string') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> initcap(text) </ENTRY
>
<
entry> initcap(text) </entry
>
<
ENTRY> text </ENTRY
>
<
entry> text </entry
>
<
ENTRY> first letter of each word to upper case </ENTRY
>
<
entry> first letter of each word to upper case </entry
>
<
ENTRY> initcap('thomas') </ENTRY
>
<
entry> initcap('thomas') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> lpad(text,int,text) </ENTRY
>
<
entry> lpad(text,int,text) </entry
>
<
ENTRY> text </ENTRY
>
<
entry> text </entry
>
<
ENTRY> left pad string to specified length </ENTRY
>
<
entry> left pad string to specified length </entry
>
<
ENTRY> lpad('hi',4,'??') </ENTRY
>
<
entry> lpad('hi',4,'??') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> ltrim(text,text) </ENTRY
>
<
entry> ltrim(text,text) </entry
>
<
ENTRY> text </ENTRY
>
<
entry> text </entry
>
<
ENTRY> left trim characters from text </ENTRY
>
<
entry> left trim characters from text </entry
>
<
ENTRY> ltrim('xxxxtrim','x') </ENTRY
>
<
entry> ltrim('xxxxtrim','x') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> textpos(text,text) </ENTRY
>
<
entry> textpos(text,text) </entry
>
<
ENTRY> text </ENTRY
>
<
entry> text </entry
>
<
ENTRY> locate specified substring </ENTRY
>
<
entry> locate specified substring </entry
>
<
ENTRY> position('high','ig') </ENTRY
>
<
entry> position('high','ig') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> rpad(text,int,text) </ENTRY
>
<
entry> rpad(text,int,text) </entry
>
<
ENTRY> text </ENTRY
>
<
entry> text </entry
>
<
ENTRY> right pad string to specified length </ENTRY
>
<
entry> right pad string to specified length </entry
>
<
ENTRY> rpad('hi',4,'x') </ENTRY
>
<
entry> rpad('hi',4,'x') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> rtrim(text,text) </ENTRY
>
<
entry> rtrim(text,text) </entry
>
<
ENTRY> text </ENTRY
>
<
entry> text </entry
>
<
ENTRY> right trim characters from text </ENTRY
>
<
entry> right trim characters from text </entry
>
<
ENTRY> rtrim('trimxxxx','x') </ENTRY
>
<
entry> rtrim('trimxxxx','x') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> substr(text,int[,int]) </ENTRY
>
<
entry> substr(text,int[,int]) </entry
>
<
ENTRY> text </ENTRY
>
<
entry> text </entry
>
<
ENTRY> extract specified substring </ENTRY
>
<
entry> extract specified substring </entry
>
<
ENTRY> substr('hi there',3,5) </ENTRY
>
<
entry> substr('hi there',3,5) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> text(char) </ENTRY
>
<
entry> text(char) </entry
>
<
ENTRY> text </ENTRY
>
<
entry> text </entry
>
<
ENTRY> convert char to text type </ENTRY
>
<
entry> convert char to text type </entry
>
<
ENTRY> text('char string') </ENTRY
>
<
entry> text('char string') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> text(varchar) </ENTRY
>
<
entry> text(varchar) </entry
>
<
ENTRY> text </ENTRY
>
<
entry> text </entry
>
<
ENTRY> convert varchar to text type </ENTRY
>
<
entry> convert varchar to text type </entry
>
<
ENTRY> text(varchar 'varchar string') </ENTRY
>
<
entry> text(varchar 'varchar string') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> translate(text,from,to) </ENTRY
>
<
entry> translate(text,from,to) </entry
>
<
ENTRY> text </ENTRY
>
<
entry> text </entry
>
<
ENTRY> convert character in string </ENTRY
>
<
entry> convert character in string </entry
>
<
ENTRY> translate('12345', '1', 'a') </ENTRY
>
<
entry> translate('12345', '1', 'a') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> varchar(char) </ENTRY
>
<
entry> varchar(char) </entry
>
<
ENTRY> varchar </ENTRY
>
<
entry> varchar </entry
>
<
ENTRY> convert char to varchar type </ENTRY
>
<
entry> convert char to varchar type </entry
>
<
ENTRY> varchar('char string') </ENTRY
>
<
entry> varchar('char string') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> varchar(text) </ENTRY
>
<
entry> varchar(text) </entry
>
<
ENTRY> varchar </ENTRY
>
<
entry> varchar </entry
>
<
ENTRY> convert text to varchar type </ENTRY
>
<
entry> convert text to varchar type </entry
>
<
ENTRY> varchar('text string') </ENTRY
>
<
entry> varchar('text string') </entry
>
</
ROW
>
</
row
>
</
TBODY
>
</
tbody
>
</
TGROUP
>
</
tgroup
>
</
TABLE
>
</
table
>
</
P
ara>
</
p
ara>
<para>
<para>
Most functions explicitly defined for text will work for char() and varchar() arguments.
Most functions explicitly defined for text will work for char() and varchar() arguments.
...
@@ -309,113 +310,114 @@
...
@@ -309,113 +310,114 @@
for manipulating various date/time types.
for manipulating various date/time types.
</para>
</para>
<
P
ara>
<
p
ara>
<
TABLE TOCENTRY
="1">
<
table tocentry
="1">
<
TITLE>Date/Time Functions</TITLE
>
<
title>Date/Time Functions</title
>
<
TGROUP COLS
="4">
<
tgroup cols
="4">
<
THEAD
>
<
thead
>
<
ROW
>
<
row
>
<
ENTRY>Function</ENTRY
>
<
entry>Function</entry
>
<
ENTRY>Returns</ENTRY
>
<
entry>Returns</entry
>
<
ENTRY>Description</ENTRY
>
<
entry>Description</entry
>
<
ENTRY>Example</ENTRY
>
<
entry>Example</entry
>
</
ROW
>
</
row
>
</
THEAD
>
</
thead
>
<
TBODY
>
<
tbody
>
<
ROW
>
<
row
>
<
ENTRY> abstime(datetime) </ENTRY
>
<
entry> abstime(datetime) </entry
>
<
ENTRY> abstime </ENTRY
>
<
entry> abstime </entry
>
<
ENTRY> convert to abstime </ENTRY
>
<
entry> convert to abstime </entry
>
<
ENTRY> abstime('now'::datetime) </ENTRY
>
<
entry> abstime('now'::datetime) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> age(datetime,datetime) </ENTRY
>
<
entry> age(datetime,datetime) </entry
>
<
ENTRY> timespan </ENTRY
>
<
entry> timespan </entry
>
<
ENTRY> span preserving months and years </ENTRY
>
<
entry> preserve months and years </entry
>
<
ENTRY> age('now','1957-06-13'::datetime) </ENTRY
>
<
entry> age('now','1957-06-13'::datetime) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> datetime(abstime) </ENTRY
>
<
entry> datetime(abstime) </entry
>
<
ENTRY> datetime </ENTRY
>
<
entry> datetime </entry
>
<
ENTRY> convert to datetime </ENTRY
>
<
entry> convert to datetime </entry
>
<
ENTRY> datetime('now'::abstime) </ENTRY
>
<
entry> datetime('now'::abstime) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> datetime(date) </ENTRY
>
<
entry> datetime(date) </entry
>
<
ENTRY> datetime </ENTRY
>
<
entry> datetime </entry
>
<
ENTRY> convert to datetime </ENTRY
>
<
entry> convert to datetime </entry
>
<
ENTRY> datetime('today'::date) </ENTRY
>
<
entry> datetime('today'::date) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> datetime(date,time) </ENTRY
>
<
entry> datetime(date,time) </entry
>
<
ENTRY> datetime </ENTRY
>
<
entry> datetime </entry
>
<
ENTRY> convert to datetime </ENTRY
>
<
entry> convert to datetime </entry
>
<
ENTRY> datetime('1998-02-24'::datetime, '23:07'::time); </ENTRY
>
<
entry> datetime('1998-02-24'::datetime, '23:07'::time); </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> date_part(text,datetime) </ENTRY
>
<
entry> date_part(text,datetime) </entry
>
<
ENTRY> float8 </ENTRY
>
<
entry> float8 </entry
>
<
ENTRY> specified portion of date field </ENTRY
>
<
entry> portion of date </entry
>
<
ENTRY> date_part('dow','now'::datetime) </ENTRY
>
<
entry> date_part('dow','now'::datetime) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> date_part(text,timespan) </ENTRY
>
<
entry> date_part(text,timespan) </entry
>
<
ENTRY> float8 </ENTRY
>
<
entry> float8 </entry
>
<
ENTRY> specified portion of time field </ENTRY
>
<
entry> portion of time </entry
>
<
ENTRY> date_part('hour','4 hrs 3 mins'::timespan) </ENTRY
>
<
entry> date_part('hour','4 hrs 3 mins'::timespan) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> date_trunc(text,datetime) </ENTRY
>
<
entry> date_trunc(text,datetime) </entry
>
<
ENTRY> datetime </ENTRY
>
<
entry> datetime </entry
>
<
ENTRY> truncate date at specified units </ENTRY
>
<
entry> truncate date </entry
>
<
ENTRY> date_trunc('month','now'::abstime) </ENTRY
>
<
entry> date_trunc('month','now'::abstime) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> isfinite(abstime) </ENTRY
>
<
entry> isfinite(abstime) </entry
>
<
ENTRY> bool </ENTRY
>
<
entry> bool </entry
>
<
ENTRY> TRUE if this is a finite time </ENTRY
>
<
entry> a finite time? </entry
>
<
ENTRY> isfinite('now'::abstime) </ENTRY
>
<
entry> isfinite('now'::abstime) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> isfinite(datetime) </ENTRY
>
<
entry> isfinite(datetime) </entry
>
<
ENTRY> bool </ENTRY
>
<
entry> bool </entry
>
<
ENTRY> TRUE if this is a finite time </ENTRY
>
<
entry> a finite time? </entry
>
<
ENTRY> isfinite('now'::datetime) </ENTRY
>
<
entry> isfinite('now'::datetime) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> isfinite(timespan) </ENTRY
>
<
entry> isfinite(timespan) </entry
>
<
ENTRY> bool </ENTRY
>
<
entry> bool </entry
>
<
ENTRY> TRUE if this is a finite time </ENTRY
>
<
entry> a finite time? </entry
>
<
ENTRY> isfinite('4 hrs'::timespan) </ENTRY
>
<
entry> isfinite('4 hrs'::timespan) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> reltime(timespan) </ENTRY
>
<
entry> reltime(timespan) </entry
>
<
ENTRY> reltime </ENTRY
>
<
entry> reltime </entry
>
<
ENTRY> convert to reltime </ENTRY
>
<
entry> convert to reltime </entry
>
<
ENTRY> reltime('4 hrs'::timespan) </ENTRY
>
<
entry> reltime('4 hrs'::timespan) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> timespan(reltime) </ENTRY
>
<
entry> timespan(reltime) </entry
>
<
ENTRY> timespan </ENTRY
>
<
entry> timespan </entry
>
<
ENTRY> convert to timespan </ENTRY
>
<
entry> convert to timespan </entry
>
<
ENTRY> timespan('4 hours'::reltime) </ENTRY
>
<
entry> timespan('4 hours'::reltime) </entry
>
</
ROW
>
</
row
>
</
TBODY
>
</
tbody
>
</
TGROUP
>
</
tgroup
>
</
TABLE
>
</
table
>
</
P
ara>
</
p
ara>
<
P
ara>
<
p
ara>
For the
For the
<
Function>date_part</Function> and <Function>date_trunc</F
unction>
<
function>date_part</function> and <function>date_trunc</f
unction>
functions, arguments can be
functions, arguments can be
`year', `month', `day', `hour', `minute', and `second',
`year', `month', `day', `hour', `minute', and `second',
as well as the more specialized quantities
as well as the more specialized quantities
`decade', `century', `millenium', `millisecond', and `microsecond'.
`decade', `century', `millenium', `millisecond', and `microsecond'.
<Function>date_part</Function> allows `dow'
<function>date_part</function> allows `dow'
to return day of week and `epoch' to return seconds since 1970 (for <Type>datetime</Type>)
to return day of week and `epoch' to return seconds since 1970
or 'epoch' to return total elapsed seconds (for <Type>timespan</Type>).
(for <type>datetime</type>)
</Para>
or 'epoch' to return total elapsed seconds (for <type>timespan</type>).
</para>
</sect1>
</sect1>
<sect1>
<sect1>
...
@@ -426,335 +428,335 @@
...
@@ -426,335 +428,335 @@
circle have a large set of native support functions.
circle have a large set of native support functions.
</para>
</para>
<
P
ara>
<
p
ara>
<
TABLE TOCENTRY
="1">
<
table tocentry
="1">
<
TITLE>Geometric Functions</TITLE
>
<
title>Geometric Functions</title
>
<
TGROUP COLS
="4">
<
tgroup cols
="4">
<
THEAD
>
<
thead
>
<
ROW
>
<
row
>
<
ENTRY>Function</ENTRY
>
<
entry>Function</entry
>
<
ENTRY>Returns</ENTRY
>
<
entry>Returns</entry
>
<
ENTRY>Description</ENTRY
>
<
entry>Description</entry
>
<
ENTRY>Example</ENTRY
>
<
entry>Example</entry
>
</
ROW
>
</
row
>
</
THEAD
>
</
thead
>
<
TBODY
>
<
tbody
>
<
ROW
>
<
row
>
<
ENTRY> area(box) </ENTRY
>
<
entry> area(box) </entry
>
<
ENTRY> float8 </ENTRY
>
<
entry> float8 </entry
>
<
ENTRY> area of box </ENTRY
>
<
entry> area of box </entry
>
<
ENTRY> area('((0,0),(1,1))'::box) </ENTRY
>
<
entry> area('((0,0),(1,1))'::box) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> area(circle) </ENTRY
>
<
entry> area(circle) </entry
>
<
ENTRY> float8 </ENTRY
>
<
entry> float8 </entry
>
<
ENTRY> area of circle </ENTRY
>
<
entry> area of circle </entry
>
<
ENTRY> area('((0,0),2.0)'::circle) </ENTRY
>
<
entry> area('((0,0),2.0)'::circle) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> box(box,box) </ENTRY
>
<
entry> box(box,box) </entry
>
<
ENTRY> box </ENTRY
>
<
entry> box </entry
>
<
ENTRY> boxes to intersection box </ENTRY
>
<
entry> boxes to intersection box </entry
>
<
ENTRY> box('((0,0),(1,1))','((0.5,0.5),(2,2))') </ENTRY
>
<
entry> box('((0,0),(1,1))','((0.5,0.5),(2,2))') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> center(box) </ENTRY
>
<
entry> center(box) </entry
>
<
ENTRY> point </ENTRY
>
<
entry> point </entry
>
<
ENTRY> center of object </ENTRY
>
<
entry> center of object </entry
>
<
ENTRY> center('((0,0),(1,2))'::box) </ENTRY
>
<
entry> center('((0,0),(1,2))'::box) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> center(circle) </ENTRY
>
<
entry> center(circle) </entry
>
<
ENTRY> point </ENTRY
>
<
entry> point </entry
>
<
ENTRY> center of object </ENTRY
>
<
entry> center of object </entry
>
<
ENTRY> center('((0,0),2.0)'::circle) </ENTRY
>
<
entry> center('((0,0),2.0)'::circle) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> diameter(circle) </ENTRY
>
<
entry> diameter(circle) </entry
>
<
ENTRY> float8 </ENTRY
>
<
entry> float8 </entry
>
<
ENTRY> diameter of circle </ENTRY
>
<
entry> diameter of circle </entry
>
<
ENTRY> diameter('((0,0),2.0)'::circle) </ENTRY
>
<
entry> diameter('((0,0),2.0)'::circle) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> height(box) </ENTRY
>
<
entry> height(box) </entry
>
<
ENTRY> float8 </ENTRY
>
<
entry> float8 </entry
>
<
ENTRY> vertical size of box </ENTRY
>
<
entry> vertical size of box </entry
>
<
ENTRY> height('((0,0),(1,1))'::box) </ENTRY
>
<
entry> height('((0,0),(1,1))'::box) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> isclosed(path) </ENTRY
>
<
entry> isclosed(path) </entry
>
<
ENTRY> bool </ENTRY
>
<
entry> bool </entry
>
<
ENTRY> TRUE if this is a closed path </ENTRY
>
<
entry> a closed path? </entry
>
<
ENTRY> isclosed('((0,0),(1,1),(2,0))'::path) </ENTRY
>
<
entry> isclosed('((0,0),(1,1),(2,0))'::path) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> isopen(path) </ENTRY
>
<
entry> isopen(path) </entry
>
<
ENTRY> bool </ENTRY
>
<
entry> bool </entry
>
<
ENTRY> TRUE if this is an open path </ENTRY
>
<
entry> an open path? </entry
>
<
ENTRY> isopen('[(0,0),(1,1),(2,0)]'::path) </ENTRY
>
<
entry> isopen('[(0,0),(1,1),(2,0)]'::path) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> length(lseg) </ENTRY
>
<
entry> length(lseg) </entry
>
<
ENTRY> float8 </ENTRY
>
<
entry> float8 </entry
>
<
ENTRY> length of line segment </ENTRY
>
<
entry> length of line segment </entry
>
<
ENTRY> length('((-1,0),(1,0))'::lseg) </ENTRY
>
<
entry> length('((-1,0),(1,0))'::lseg) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> length(path) </ENTRY
>
<
entry> length(path) </entry
>
<
ENTRY> float8 </ENTRY
>
<
entry> float8 </entry
>
<
ENTRY> length of path </ENTRY
>
<
entry> length of path </entry
>
<
ENTRY> length('((0,0),(1,1),(2,0))'::path) </ENTRY
>
<
entry> length('((0,0),(1,1),(2,0))'::path) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> pclose(path) </ENTRY
>
<
entry> pclose(path) </entry
>
<
ENTRY> path </ENTRY
>
<
entry> path </entry
>
<
ENTRY> convert path to closed variant </ENTRY
>
<
entry> convert path to closed </entry
>
<
ENTRY> popen('[(0,0),(1,1),(2,0)]'::path) </ENTRY
>
<
entry> popen('[(0,0),(1,1),(2,0)]'::path) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> point(lseg,lseg) </ENTRY
>
<
entry> point(lseg,lseg) </entry
>
<
ENTRY> point </ENTRY
>
<
entry> point </entry
>
<
ENTRY> convert to point (intersection) </ENTRY
>
<
entry> intersection </entry
>
<
ENTRY> point('((-1,0),(1,0))'::lseg,'((-2,-2),(2,2))'::lseg) </ENTRY
>
<
entry> point('((-1,0),(1,0))'::lseg,'((-2,-2),(2,2))'::lseg) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> points(path) </ENTRY
>
<
entry> points(path) </entry
>
<
ENTRY> int4 </ENTRY
>
<
entry> int4 </entry
>
<
ENTRY> number of points in path </ENTRY
>
<
entry> number of points </entry
>
<
ENTRY> points('[(0,0),(1,1),(2,0)]'::path) </ENTRY
>
<
entry> points('[(0,0),(1,1),(2,0)]'::path) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> popen(path) </ENTRY
>
<
entry> popen(path) </entry
>
<
ENTRY> path </ENTRY
>
<
entry> path </entry
>
<
ENTRY> convert path to open variant </ENTRY
>
<
entry> convert path to open </entry
>
<
ENTRY> popen('((0,0),(1,1),(2,0))'::path) </ENTRY
>
<
entry> popen('((0,0),(1,1),(2,0))'::path) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> radius(circle) </ENTRY
>
<
entry> radius(circle) </entry
>
<
ENTRY> float8 </ENTRY
>
<
entry> float8 </entry
>
<
ENTRY> radius of circle </ENTRY
>
<
entry> radius of circle </entry
>
<
ENTRY> radius('((0,0),2.0)'::circle) </ENTRY
>
<
entry> radius('((0,0),2.0)'::circle) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> width(box) </ENTRY
>
<
entry> width(box) </entry
>
<
ENTRY> float8 </ENTRY
>
<
entry> float8 </entry
>
<
ENTRY> horizontal size of box </ENTRY
>
<
entry> horizontal size </entry
>
<
ENTRY> width('((0,0),(1,1))'::box) </ENTRY
>
<
entry> width('((0,0),(1,1))'::box) </entry
>
</
ROW
>
</
row
>
</
TBODY
>
</
tbody
>
</
TGROUP
>
</
tgroup
>
</
TABLE
>
</
table
>
</
P
ara>
</
p
ara>
<
P
ara>
<
p
ara>
<
TABLE TOCENTRY
="1">
<
table tocentry
="1">
<
TITLE>Geometric Type Conversion Functions</TITLE
>
<
title>Geometric Type Conversion Functions</title
>
<
TGROUP COLS
="4">
<
tgroup cols
="4">
<
THEAD
>
<
thead
>
<
ROW
>
<
row
>
<
ENTRY>Function</ENTRY
>
<
entry>Function</entry
>
<
ENTRY>Returns</ENTRY
>
<
entry>Returns</entry
>
<
ENTRY>Description</ENTRY
>
<
entry>Description</entry
>
<
ENTRY>Example</ENTRY
>
<
entry>Example</entry
>
</
ROW
>
</
row
>
</
THEAD
>
</
thead
>
<
TBODY
>
<
tbody
>
<
ROW
>
<
row
>
<
ENTRY> box(circle) </ENTRY
>
<
entry> box(circle) </entry
>
<
ENTRY> box </ENTRY
>
<
entry> box </entry
>
<
ENTRY> convert circle to box </ENTRY
>
<
entry> convert circle to box </entry
>
<
ENTRY> box('((0,0),2.0)'::circle) </ENTRY
>
<
entry> box('((0,0),2.0)'::circle) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> box(point,point) </ENTRY
>
<
entry> box(point,point) </entry
>
<
ENTRY> box </ENTRY
>
<
entry> box </entry
>
<
ENTRY> convert points to box </ENTRY
>
<
entry> convert points to box </entry
>
<
ENTRY> box('(0,0)'::point,'(1,1)'::point) </ENTRY
>
<
entry> box('(0,0)'::point,'(1,1)'::point) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> box(polygon) </ENTRY
>
<
entry> box(polygon) </entry
>
<
ENTRY> box </ENTRY
>
<
entry> box </entry
>
<
ENTRY> convert polygon to box </ENTRY
>
<
entry> convert polygon to box </entry
>
<
ENTRY> box('((0,0),(1,1),(2,0))'::polygon) </ENTRY
>
<
entry> box('((0,0),(1,1),(2,0))'::polygon) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> circle(box) </ENTRY
>
<
entry> circle(box) </entry
>
<
ENTRY> circle </ENTRY
>
<
entry> circle </entry
>
<
ENTRY> convert to circle </ENTRY
>
<
entry> convert to circle </entry
>
<
ENTRY> circle('((0,0),(1,1))'::box) </ENTRY
>
<
entry> circle('((0,0),(1,1))'::box) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> circle(point,float8) </ENTRY
>
<
entry> circle(point,float8) </entry
>
<
ENTRY> circle </ENTRY
>
<
entry> circle </entry
>
<
ENTRY> convert to circle </ENTRY
>
<
entry> convert to circle </entry
>
<
ENTRY> circle('(0,0)'::point,2.0) </ENTRY
>
<
entry> circle('(0,0)'::point,2.0) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> lseg(box) </ENTRY
>
<
entry> lseg(box) </entry
>
<
ENTRY> lseg </ENTRY
>
<
entry> lseg </entry
>
<
ENTRY> convert diagonal to lseg </ENTRY
>
<
entry> convert diagonal to lseg </entry
>
<
ENTRY> lseg('((-1,0),(1,0))'::box) </ENTRY
>
<
entry> lseg('((-1,0),(1,0))'::box) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> lseg(point,point) </ENTRY
>
<
entry> lseg(point,point) </entry
>
<
ENTRY> lseg </ENTRY
>
<
entry> lseg </entry
>
<
ENTRY> convert to lseg </ENTRY
>
<
entry> convert to lseg </entry
>
<
ENTRY> lseg('(-1,0)'::point,'(1,0)'::point) </ENTRY
>
<
entry> lseg('(-1,0)'::point,'(1,0)'::point) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> path(polygon) </ENTRY
>
<
entry> path(polygon) </entry
>
<
ENTRY> point </ENTRY
>
<
entry> point </entry
>
<
ENTRY> convert to path </ENTRY
>
<
entry> convert to path </entry
>
<
ENTRY> path('((0,0),(1,1),(2,0))'::polygon) </ENTRY
>
<
entry> path('((0,0),(1,1),(2,0))'::polygon) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> point(circle) </ENTRY
>
<
entry> point(circle) </entry
>
<
ENTRY> point </ENTRY
>
<
entry> point </entry
>
<
ENTRY> convert to point (center) </ENTRY
>
<
entry> convert to point (center) </entry
>
<
ENTRY> point('((0,0),2.0)'::circle) </ENTRY
>
<
entry> point('((0,0),2.0)'::circle) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> point(lseg,lseg) </ENTRY
>
<
entry> point(lseg,lseg) </entry
>
<
ENTRY> point </ENTRY
>
<
entry> point </entry
>
<
ENTRY> convert to point (intersection) </ENTRY
>
<
entry> convert to point (intersection) </entry
>
<
ENTRY> point('((-1,0),(1,0))'::lseg,'((-2,-2),(2,2))'::lseg) </ENTRY
>
<
entry> point('((-1,0),(1,0))'::lseg, '((-2,-2),(2,2))'::lseg) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> point(polygon) </ENTRY
>
<
entry> point(polygon) </entry
>
<
ENTRY> point </ENTRY
>
<
entry> point </entry
>
<
ENTRY> center of polygon </ENTRY
>
<
entry> center of polygon </entry
>
<
ENTRY> point('((0,0),(1,1),(2,0))'::polygon) </ENTRY
>
<
entry> point('((0,0),(1,1),(2,0))'::polygon) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> polygon(box) </ENTRY
>
<
entry> polygon(box) </entry
>
<
ENTRY> polygon </ENTRY
>
<
entry> polygon </entry
>
<
ENTRY> convert to polygon with 12 points </ENTRY
>
<
entry> convert to polygon with 12 points </entry
>
<
ENTRY> polygon('((0,0),(1,1))'::box) </ENTRY
>
<
entry> polygon('((0,0),(1,1))'::box) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> polygon(circle) </ENTRY
>
<
entry> polygon(circle) </entry
>
<
ENTRY> polygon </ENTRY
>
<
entry> polygon </entry
>
<
ENTRY> convert to polygon with 12 points </ENTRY
>
<
entry> convert to 12-point polygon </entry
>
<
ENTRY> polygon('((0,0),2.0)'::circle) </ENTRY
>
<
entry> polygon('((0,0),2.0)'::circle) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> polygon(npts,circle) </ENTRY
>
<
entry> polygon(<replaceable class="parameter">npts</replaceable>,circle) </entry
>
<
ENTRY> polygon </ENTRY
>
<
entry> polygon </entry
>
<
ENTRY> convert to polygon with npts points </ENTRY
>
<
entry> convert to <replaceable class="parameter">npts</replaceable> polygon </entry
>
<
ENTRY> polygon(12,'((0,0),2.0)'::circle) </ENTRY
>
<
entry> polygon(12,'((0,0),2.0)'::circle) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> polygon(path) </ENTRY
>
<
entry> polygon(path) </entry
>
<
ENTRY> polygon </ENTRY
>
<
entry> polygon </entry
>
<
ENTRY> convert to polygon </ENTRY
>
<
entry> convert to polygon </entry
>
<
ENTRY> polygon('((0,0),(1,1),(2,0))'::path) </ENTRY
>
<
entry> polygon('((0,0),(1,1),(2,0))'::path) </entry
>
</
ROW
>
</
row
>
</
TBODY
>
</
tbody
>
</
TGROUP
>
</
tgroup
>
</
TABLE
>
</
table
>
</
P
ara>
</
p
ara>
<
P
ara>
<
p
ara>
<
TABLE TOCENTRY
="1">
<
table tocentry
="1">
<
TITLE>Geometric Upgrade Functions</TITLE
>
<
title>Geometric Upgrade Functions</title
>
<
TGROUP COLS
="4">
<
tgroup cols
="4">
<
THEAD
>
<
thead
>
<
ROW
>
<
row
>
<
ENTRY>Function</ENTRY
>
<
entry>Function</entry
>
<
ENTRY>Returns</ENTRY
>
<
entry>Returns</entry
>
<
ENTRY>Description</ENTRY
>
<
entry>Description</entry
>
<
ENTRY>Example</ENTRY
>
<
entry>Example</entry
>
</
ROW
>
</
row
>
</
THEAD
>
</
thead
>
<
TBODY
>
<
tbody
>
<
ROW
>
<
row
>
<
ENTRY> isoldpath(path) </ENTRY
>
<
entry> isoldpath(path) </entry
>
<
ENTRY> path </ENTRY
>
<
entry> path </entry
>
<
ENTRY> test path for pre-v6.1 form </ENTRY
>
<
entry> test path for pre-v6.1 form </entry
>
<
ENTRY> isoldpath('(1,3,0,0,1,1,2,0)'::path) </ENTRY
>
<
entry> isoldpath('(1,3,0,0,1,1,2,0)'::path) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> revertpoly(polygon) </ENTRY
>
<
entry> revertpoly(polygon) </entry
>
<
ENTRY> polygon </ENTRY
>
<
entry> polygon </entry
>
<
ENTRY> convert pre-v6.1 polygon </ENTRY
>
<
entry> convert pre-v6.1 polygon </entry
>
<
ENTRY> revertpoly('((0,0),(1,1),(2,0))'::polygon) </ENTRY
>
<
entry> revertpoly('((0,0),(1,1),(2,0))'::polygon) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> upgradepath(path) </ENTRY
>
<
entry> upgradepath(path) </entry
>
<
ENTRY> path </ENTRY
>
<
entry> path </entry
>
<
ENTRY> convert pre-v6.1 path </ENTRY
>
<
entry> convert pre-v6.1 path </entry
>
<
ENTRY> upgradepath('(1,3,0,0,1,1,2,0)'::path) </ENTRY
>
<
entry> upgradepath('(1,3,0,0,1,1,2,0)'::path) </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> upgradepoly(polygon) </ENTRY
>
<
entry> upgradepoly(polygon) </entry
>
<
ENTRY> polygon </ENTRY
>
<
entry> polygon </entry
>
<
ENTRY> convert pre-v6.1 polygon </ENTRY
>
<
entry> convert pre-v6.1 polygon </entry
>
<
ENTRY> upgradepoly('(0,1,2,0,1,0)'::polygon) </ENTRY
>
<
entry> upgradepoly('(0,1,2,0,1,0)'::polygon) </entry
>
</
ROW
>
</
row
>
</
TBODY
>
</
tbody
>
</
TGROUP
>
</
tgroup
>
</
TABLE
>
</
table
>
</
P
ara>
</
p
ara>
</sect1>
</sect1>
<sect1>
<sect1>
<title id="cidr-funcs">IP V4 Functions</title>
<title id="cidr-funcs">IP V4 Functions</title>
<
P
ara>
<
p
ara>
<
TABLE TOCENTRY
="1">
<
table tocentry
="1">
<
TITLE><ProductName>Postgres</ProductName>IP V4 Functions</TITLE
>
<
title><productname>Postgres</productname>IP V4 Functions</title
>
<
TGROUP COLS
="4">
<
tgroup cols
="4">
<
THEAD
>
<
thead
>
<
ROW
>
<
row
>
<
ENTRY>Function</ENTRY
>
<
entry>Function</entry
>
<
ENTRY>Returns</ENTRY
>
<
entry>Returns</entry
>
<
ENTRY>Description</ENTRY
>
<
entry>Description</entry
>
<
ENTRY>Example</ENTRY
>
<
entry>Example</entry
>
</
ROW
>
</
row
>
</
THEAD
>
</
thead
>
<
TBODY
>
<
tbody
>
<
ROW
>
<
row
>
<
ENTRY> broadcast(cidr) </ENTRY
>
<
entry> broadcast(cidr) </entry
>
<
ENTRY> text </ENTRY
>
<
entry> text </entry
>
<
ENTRY> construct broadcast address as text </ENTRY
>
<
entry> construct broadcast address as text </entry
>
<
ENTRY> broadcast('192.168.1.5/24') ==> '192.168.1.255' </ENTRY
>
<
entry> broadcast('192.168.1.5/24') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> broadcast(inet) </ENTRY
>
<
entry> broadcast(inet) </entry
>
<
ENTRY> text </ENTRY
>
<
entry> text </entry
>
<
ENTRY> construct broadcast address as text </ENTRY
>
<
entry> construct broadcast address as text </entry
>
<
ENTRY> broadcast('192.168.1.5/24') ==> '192.168.1.255' </ENTRY
>
<
entry> broadcast('192.168.1.5/24') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> host(inet) </ENTRY
>
<
entry> host(inet) </entry
>
<
ENTRY> text </ENTRY
>
<
entry> text </entry
>
<
ENTRY> extract host address as text </ENTRY
>
<
entry> extract host address as text </entry
>
<
ENTRY> host('192.168.1.5/24') ==> '192.168.1.5' </ENTRY
>
<
entry> host('192.168.1.5/24') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> masklen(cidr) </ENTRY
>
<
entry> masklen(cidr) </entry
>
<
ENTRY> int4 </ENTRY
>
<
entry> int4 </entry
>
<
ENTRY> calculate netmask length </ENTRY
>
<
entry> calculate netmask length </entry
>
<
ENTRY> masklen('192.168.1.5/24') ==> 24</ENTRY
>
<
entry> masklen('192.168.1.5/24') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> masklen(inet) </ENTRY
>
<
entry> masklen(inet) </entry
>
<
ENTRY> int4 </ENTRY
>
<
entry> int4 </entry
>
<
ENTRY> calculate netmask length </ENTRY
>
<
entry> calculate netmask length </entry
>
<
ENTRY> masklen('192.168.1.5/24') ==> 24 </ENTRY
>
<
entry> masklen('192.168.1.5/24') </entry
>
</
ROW
>
</
row
>
<
ROW
>
<
row
>
<
ENTRY> netmask(inet) </ENTRY
>
<
entry> netmask(inet) </entry
>
<
ENTRY> text </ENTRY
>
<
entry> text </entry
>
<
ENTRY> construct netmask as text </ENTRY
>
<
entry> construct netmask as text </entry
>
<
ENTRY> netmask('192.168.1.5/24') ==> '255.255.255.0' </ENTRY
>
<
entry> netmask('192.168.1.5/24') </entry
>
</
ROW
>
</
row
>
</
TBODY
>
</
tbody
>
</
TGROUP
>
</
tgroup
>
</
TABLE
>
</
table
>
</
P
ara>
</
p
ara>
</
S
ect1>
</
s
ect1>
</chapter>
</chapter>
...
...
doc/src/sgml/lobj.sgml
View file @
5e84d58e
<Chapter Id="largeObjects">
<chapter id="largeObjects">
<Title>Large Objects</Title>
<title id="largeObjects-title">Large Objects</title>
<Para>
<para>
In <ProductName>Postgres</ProductName>, data values are stored in tuples and
In <productname>Postgres</productname>,
individual tuples cannot span data pages. Since the size of
data values are stored in tuples and
a data page is 8192 bytes, the upper limit on the size
individual tuples cannot span data pages. Since the size of
of a data value is relatively low. To support the storage
a data page is 8192 bytes, the upper limit on the size
of larger atomic values, <ProductName>Postgres</ProductName> provides a large
of a data value is relatively low. To support the storage
object interface. This interface provides file
of larger atomic values,
oriented access to user data that has been declared to
<productname>Postgres</productname> provides a large
be a large type.
object interface. This interface provides file
This section describes the implementation and the
oriented access to user data that has been declared to
programmatic and query language interfaces to <ProductName>Postgres</ProductName>
be a large type.
large object data.
This section describes the implementation and the
</Para>
programmatic and query language interfaces to
<productname>Postgres</productname>
<Sect1>
large object data.
<Title>Historical Note</Title>
</para>
<Para>
<sect1>
Originally, <ProductName>Postgres 4.2</ProductName> supported three standard
<title>Historical Note</title>
<para>
Originally, <productname>Postgres 4.2</productname> supported three standard
implementations of large objects: as files external
implementations of large objects: as files external
to <ProductName>Postgres</ProductName>, as <Acronym>UNIX</Acronym> files managed by <ProductName>Postgres</ProductName>, and as data
to <productname>Postgres</productname>, as
stored within the <ProductName>Postgres</ProductName> database. It causes
<acronym>ym>U</acronym>ym> files managed by <productname>Postgres</productname>, and as data
stored within the <productname>Postgres</productname> database. It causes
considerable confusion among users. As a result, we only
considerable confusion among users. As a result, we only
support large objects as data stored within the <
ProductName>Postgres</ProductN
ame>
support large objects as data stored within the <
productname>Postgres</productn
ame>
database in <
ProductName>PostgreSQL</ProductN
ame>. Even though it is slower to
database in <
productname>PostgreSQL</productn
ame>. Even though it is slower to
access, it provides stricter data integrity.
access, it provides stricter data integrity.
For historical reasons, this storage scheme is referred to as
For historical reasons, this storage scheme is referred to as
Inversion large objects. (We will use Inversion and large
Inversion large objects. (We will use Inversion and large
objects interchangeably to mean the same thing in this
objects interchangeably to mean the same thing in this
section.)
section.)
</
P
ara>
</
p
ara>
</
S
ect1>
</
s
ect1>
<
S
ect1>
<
s
ect1>
<
Title>Inversion Large Objects</T
itle>
<
title>Inversion Large Objects</t
itle>
<
P
ara>
<
p
ara>
The Inversion large object implementation breaks large
The Inversion large object implementation breaks large
objects up into "chunks" and stores the chunks in
objects up into "chunks" and stores the chunks in
tuples in the database. A B-tree index guarantees fast
tuples in the database. A B-tree index guarantees fast
searches for the correct chunk number when doing random
searches for the correct chunk number when doing random
access reads and writes.
access reads and writes.
</
P
ara>
</
p
ara>
</
S
ect1>
</
s
ect1>
<
S
ect1>
<
s
ect1>
<
Title>Large Object Interfaces</T
itle>
<
title>Large Object Interfaces</t
itle>
<
P
ara>
<
p
ara>
The facilities <
ProductName>Postgres</ProductN
ame> provides to access large
The facilities <
productname>Postgres</productn
ame> provides to access large
objects, both in the backend as part of user-defined
objects, both in the backend as part of user-defined
functions or the front end as part of an application
functions or the front end as part of an application
using the interface, are described below. (For users
using the interface, are described below. (For users
familiar with <ProductName>Postgres 4.2</ProductName>, <ProductName>PostgreSQL</ProductName> has a new set of
familiar with <productname>Postgres 4.2</productname>,
<productname>PostgreSQL</productname> has a new set of
functions providing a more coherent interface. The
functions providing a more coherent interface. The
interface is the same for dynamically-loaded C
interface is the same for dynamically-loaded C
functions as well as for XXX LOST TEXT? WHAT SHOULD GO HERE??.
functions as well as for XXX LOST TEXT? WHAT SHOULD GO HERE??.
The <ProductName>Postgres</ProductName> large object interface is modeled after
The <productname>Postgres</productname> large object interface is modeled after
the <Acronym>UNIX</Acronym> file system interface, with analogues of
the <acronym>UNIX</acronym> file system interface, with analogues of
<Function>open(2)</Function>, <Function>read(2)</Function>, <Function>write(2)</Function>,
<function>open(2)</function>, <function>read(2)</function>,
<Function>lseek(2)</Function>, etc. User
<function>write(2)</function>,
<function>lseek(2)</function>, etc. User
functions call these routines to retrieve only the data of
functions call these routines to retrieve only the data of
interest from a large object. For example, if a large
interest from a large object. For example, if a large
object type called mugshot existed that stored
object type called mugshot existed that stored
...
@@ -72,81 +78,82 @@
...
@@ -72,81 +78,82 @@
the beard that appeared there, if any. The entire
the beard that appeared there, if any. The entire
large object value need not be buffered, or even
large object value need not be buffered, or even
examined, by the beard function.
examined, by the beard function.
Large objects may be accessed from dynamically-loaded <
Acronym>C</A
cronym>
Large objects may be accessed from dynamically-loaded <
acronym>C</a
cronym>
functions or database client programs that link the
functions or database client programs that link the
library. <
ProductName>Postgres</ProductN
ame> provides a set of routines that
library. <
productname>Postgres</productn
ame> provides a set of routines that
support opening, reading, writing, closing, and seeking on
support opening, reading, writing, closing, and seeking on
large objects.
large objects.
</
P
ara>
</
p
ara>
<
S
ect2>
<
s
ect2>
<
Title>Creating a Large Object</T
itle>
<
title>Creating a Large Object</t
itle>
<
P
ara>
<
p
ara>
The routine
The routine
<
ProgramL
isting>
<
programl
isting>
Oid lo_creat(PGconn *conn, int mode)
Oid lo_creat(PGconn *conn, int mode)
</
ProgramL
isting>
</
programl
isting>
creates a new large object. The mode is a bitmask
creates a new large object. The mode is a bitmask
describing several different attributes of the new
describing several different attributes of the new
object. The symbolic constants listed here are defined
object. The symbolic constants listed here are defined
in
in
<
FileN
ame>
<
filen
ame>
PGROOT/src/backend/libpq/libpq-fs.h
PGROOT/src/backend/libpq/libpq-fs.h
</
FileN
ame>
</
filen
ame>
The access type (read, write, or both) is controlled by
The access type (read, write, or both) is controlled by
OR ing together the bits <Acronym>INV_READ</Acronym> and <Acronym>INV_WRITE</Acronym>. If
OR ing together the bits <acronym>INV_READ</acronym> and
<acronym>INV_WRITE</acronym>. If
the large object should be archived -- that is, if
the large object should be archived -- that is, if
historical versions of it should be moved periodically to
historical versions of it should be moved periodically to
a special archive relation -- then the <
Acronym>INV_ARCHIVE</A
cronym> bit
a special archive relation -- then the <
acronym>INV_ARCHIVE</a
cronym> bit
should be set. The low-order sixteen bits of mask are
should be set. The low-order sixteen bits of mask are
the storage manager number on which the large object
the storage manager number on which the large object
should reside. For sites other than Berkeley, these
should reside. For sites other than Berkeley, these
bits should always be zero.
bits should always be zero.
The commands below create an (Inversion) large object:
The commands below create an (Inversion) large object:
<
ProgramL
isting>
<
programl
isting>
inv_oid = lo_creat(INV_READ|INV_WRITE|INV_ARCHIVE);
inv_oid = lo_creat(INV_READ|INV_WRITE|INV_ARCHIVE);
</
ProgramL
isting>
</
programl
isting>
</
P
ara>
</
p
ara>
</
S
ect2>
</
s
ect2>
<
S
ect2>
<
s
ect2>
<
Title>Importing a Large Object</T
itle>
<
title>Importing a Large Object</t
itle>
<
P
ara>
<
p
ara>
To import a <
Acronym>UNIX</A
cronym> file as
To import a <
acronym>UNIX</a
cronym> file as
a large object, call
a large object, call
<
ProgramL
isting>
<
programl
isting>
Oid lo_import(PGconn *conn, text *filename)
Oid lo_import(PGconn *conn, text *filename)
</
ProgramL
isting>
</
programl
isting>
The filename argument specifies the <
Acronym>UNIX</A
cronym> pathname of
The filename argument specifies the <
acronym>UNIX</a
cronym> pathname of
the file to be imported as a large object.
the file to be imported as a large object.
</
P
ara>
</
p
ara>
</
S
ect2>
</
s
ect2>
<
S
ect2>
<
s
ect2>
<
Title>Exporting a Large Object</T
itle>
<
title>Exporting a Large Object</t
itle>
<
P
ara>
<
p
ara>
To export a large object
To export a large object
into <
Acronym>UNIX</A
cronym> file, call
into <
acronym>UNIX</a
cronym> file, call
<
ProgramL
isting>
<
programl
isting>
int lo_export(PGconn *conn, Oid lobjId, text *filename)
int lo_export(PGconn *conn, Oid lobjId, text *filename)
</
ProgramL
isting>
</
programl
isting>
The lobjId argument specifies the Oid of the large
The lobjId argument specifies the Oid of the large
object to export and the filename argument specifies
object to export and the filename argument specifies
the <
Acronym>UNIX</A
cronym> pathname of the file.
the <
acronym>UNIX</a
cronym> pathname of the file.
</
P
ara>
</
p
ara>
</
S
ect2>
</
s
ect2>
<
S
ect2>
<
s
ect2>
<
Title>Opening an Existing Large Object</T
itle>
<
title>Opening an Existing Large Object</t
itle>
<
P
ara>
<
p
ara>
To open an existing large object, call
To open an existing large object, call
<
ProgramL
isting>
<
programl
isting>
int lo_open(PGconn *conn, Oid lobjId, int mode, ...)
int lo_open(PGconn *conn, Oid lobjId, int mode, ...)
</
ProgramL
isting>
</
programl
isting>
The lobjId argument specifies the Oid of the large
The lobjId argument specifies the Oid of the large
object to open. The mode bits control whether the
object to open. The mode bits control whether the
object is opened for reading INV_READ), writing or
object is opened for reading INV_READ), writing or
...
@@ -154,64 +161,65 @@ int lo_open(PGconn *conn, Oid lobjId, int mode, ...)
...
@@ -154,64 +161,65 @@ int lo_open(PGconn *conn, Oid lobjId, int mode, ...)
A large object cannot be opened before it is created.
A large object cannot be opened before it is created.
lo_open returns a large object descriptor for later use
lo_open returns a large object descriptor for later use
in lo_read, lo_write, lo_lseek, lo_tell, and lo_close.
in lo_read, lo_write, lo_lseek, lo_tell, and lo_close.
</
P
ara>
</
p
ara>
</
S
ect2>
</
s
ect2>
<
S
ect2>
<
s
ect2>
<
Title>Writing Data to a Large Object</T
itle>
<
title>Writing Data to a Large Object</t
itle>
<
P
ara>
<
p
ara>
The routine
The routine
<
ProgramL
isting>
<
programl
isting>
int lo_write(PGconn *conn, int fd, char *buf, int len)
int lo_write(PGconn *conn, int fd, char *buf, int len)
</
ProgramL
isting>
</
programl
isting>
writes len bytes from buf to large object fd. The fd
writes len bytes from buf to large object fd. The fd
argument must have been returned by a previous lo_open.
argument must have been returned by a previous lo_open.
The number of bytes actually written is returned. In
The number of bytes actually written is returned. In
the event of an error, the return value is negative.
the event of an error, the return value is negative.
</
P
ara>
</
p
ara>
</
S
ect2>
</
s
ect2>
<
S
ect2>
<
s
ect2>
<
Title>Seeking on a Large Object</T
itle>
<
title>Seeking on a Large Object</t
itle>
<
P
ara>
<
p
ara>
To change the current read or write location on a large
To change the current read or write location on a large
object, call
object, call
<
ProgramL
isting>
<
programl
isting>
int lo_lseek(PGconn *conn, int fd, int offset, int whence)
int lo_lseek(PGconn *conn, int fd, int offset, int whence)
</
ProgramL
isting>
</
programl
isting>
This routine moves the current location pointer for the
This routine moves the current location pointer for the
large object described by fd to the new location specified
large object described by fd to the new location specified
by offset. The valid values for .i whence are
by offset. The valid values for .i whence are
SEEK_SET SEEK_CUR and SEEK_END.
SEEK_SET SEEK_CUR and SEEK_END.
</
P
ara>
</
p
ara>
</
S
ect2>
</
s
ect2>
<
S
ect2>
<
s
ect2>
<
Title>Closing a Large Object Descriptor</T
itle>
<
title>Closing a Large Object Descriptor</t
itle>
<
P
ara>
<
p
ara>
A large object may be closed by calling
A large object may be closed by calling
<
ProgramL
isting>
<
programl
isting>
int lo_close(PGconn *conn, int fd)
int lo_close(PGconn *conn, int fd)
</
ProgramL
isting>
</
programl
isting>
where fd is a large object descriptor returned by
where fd is a large object descriptor returned by
lo_open. On success, <
Acronym>lo_close</A
cronym> returns zero. On error,
lo_open. On success, <
acronym>lo_close</a
cronym> returns zero. On error,
the return value is negative.
the return value is negative.
</
P
ara>
</
p
ara>
</sect2>
</sect2>
</
S
ect1>
</
s
ect1>
<
S
ect1>
<
s
ect1>
<
Title>Built in registered functions</T
itle>
<
title>Built in registered functions</t
itle>
<Para>
<para>
There are two built-in registered functions, <Acronym>lo_import</Acronym>
There are two built-in registered functions, <acronym>lo_import</acronym>
and <Acronym>lo_export</Acronym> which are convenient for use in <Acronym>SQL</Acronym>
and <acronym>lo_export</acronym> which are convenient for use
in <acronym>SQL</acronym>
queries.
queries.
Here is an example of their use
Here is an example of their use
<
ProgramL
isting>
<
programl
isting>
CREATE TABLE image (
CREATE TABLE image (
name text,
name text,
raster oid
raster oid
...
@@ -222,33 +230,33 @@ INSERT INTO image (name, raster)
...
@@ -222,33 +230,33 @@ INSERT INTO image (name, raster)
SELECT lo_export(image.raster, "/tmp/motd") from image
SELECT lo_export(image.raster, "/tmp/motd") from image
WHERE name = 'beautiful image';
WHERE name = 'beautiful image';
</
ProgramL
isting>
</
programl
isting>
</
P
ara>
</
p
ara>
</
S
ect1>
</
s
ect1>
<
S
ect1>
<
s
ect1>
<
Title>Accessing Large Objects from LIBPQ</T
itle>
<
title>Accessing Large Objects from LIBPQ</t
itle>
<
P
ara>
<
p
ara>
Below is a sample program which shows how the large object
Below is a sample program which shows how the large object
interface
interface
in LIBPQ can be used. Parts of the program are
in LIBPQ can be used. Parts of the program are
commented out but are left in the source for the readers
commented out but are left in the source for the readers
benefit. This program can be found in
benefit. This program can be found in
<
FileN
ame>
<
filen
ame>
../src/test/examples
../src/test/examples
</
FileN
ame>
</
filen
ame>
Frontend applications which use the large object interface
Frontend applications which use the large object interface
in LIBPQ should include the header file
in LIBPQ should include the header file
libpq/libpq-fs.h and link with the libpq library.
libpq/libpq-fs.h and link with the libpq library.
</
P
ara>
</
p
ara>
</
S
ect1>
</
s
ect1>
<
S
ect1>
<
s
ect1>
<
Title>Sample Program</T
itle>
<
title>Sample Program</t
itle>
<
P
ara>
<
p
ara>
<
ProgramL
isting>
<
programl
isting>
/*--------------------------------------------------------------
/*--------------------------------------------------------------
*
*
* testlo.c--
* testlo.c--
...
@@ -479,8 +487,25 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
...
@@ -479,8 +487,25 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
PQfinish(conn);
PQfinish(conn);
exit(0);
exit(0);
}
}
</ProgramListing>
</programlisting>
</Para>
</para>
</Sect1>
</sect1>
</Chapter>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"./reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->
doc/src/sgml/release.sgml
View file @
5e84d58e
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
</para>
</para>
<para>
<para>
Here is a brief summary of
some of the more notic
able changes:
Here is a brief summary of
the more not
able changes:
<variablelist>
<variablelist>
<varlistentry>
<varlistentry>
...
@@ -188,16 +188,16 @@
...
@@ -188,16 +188,16 @@
<para>
<para>
Because readers in 6.5 don't lock data, regardless of transaction
Because readers in 6.5 don't lock data, regardless of transaction
isolation level, data read by one transaction can be overwritten by
isolation level, data read by one transaction can be overwritten by
another. In
the
other words, if a row is returned by
another. In other words, if a row is returned by
<command>SELECT</command> it doesn't mean that this row really exists
<command>SELECT</command> it doesn't mean that this row really exists
at the time it is returned (i.e. sometime after the statement or
at the time it is returned (i.e. sometime after the statement or
transaction began) nor that the row is protected from
deletion
or
transaction began) nor that the row is protected from
being deleted
or
update by concurrent transactions before the current transaction does
update
d
by concurrent transactions before the current transaction does
a commit or rollback.
a commit or rollback.
</para>
</para>
<para>
<para>
To ensure the actual exist
a
nce of a row and protect it against
To ensure the actual exist
e
nce of a row and protect it against
concurrent updates one must use <command>SELECT FOR UPDATE</command> or
concurrent updates one must use <command>SELECT FOR UPDATE</command> or
an appropriate <command>LOCK TABLE</command> statement. This should be
an appropriate <command>LOCK TABLE</command> statement. This should be
taken into account when porting applications from previous releases of
taken into account when porting applications from previous releases of
...
@@ -205,7 +205,8 @@
...
@@ -205,7 +205,8 @@
</para>
</para>
<para>
<para>
Keep above in mind if you are using contrib/refint.* triggers for
Keep the above in mind if you are using
<filename>contrib/refint.*</filename> triggers for
referential integrity. Additional technics are required now. One way is
referential integrity. Additional technics are required now. One way is
to use <command>LOCK parent_table IN SHARE ROW EXCLUSIVE MODE</command>
to use <command>LOCK parent_table IN SHARE ROW EXCLUSIVE MODE</command>
command if a transaction is going to update/delete a primary key and
command if a transaction is going to update/delete a primary key and
...
@@ -2634,6 +2635,7 @@ Initial release.
...
@@ -2634,6 +2635,7 @@ Initial release.
<programlisting>
<programlisting>
Time System
Time System
02:00 Dual Pentium Pro 180, 224MB, UW-SCSI, Linux 2.0.36, gcc 2.7.2.3 -O2 -m486
02:00 Dual Pentium Pro 180, 224MB, UW-SCSI, Linux 2.0.36, gcc 2.7.2.3 -O2 -m486
04:38 Sparc Ultra 1 143MHz, 64MB, Solaris 2.6
</programlisting>
</programlisting>
</para>
</para>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment