PostgreSQL Functions By Example
Overview Function Basics
By Example
PostgreSQL Functions By Example
Joe Conway joe.conway@
credativ Group
January 20, 2012
Joe Conway
SCALE10X-PGDay
Overview Function Basics
By Example
What are Functions?
Introduction Uses Varieties Languages
Full fledged SQL objects
Many other database objects are implemented with them
Fundamental part of PostgreSQL's system architecture
Created with CREATE FUNCTION Executed through normal SQL
target-list: SELECT myfunc(f1) FROM foo; FROM clause: SELECT * FROM myfunc(); WHERE clause: SELECT * FROM foo WHERE myfunc(f1) = 42;
Joe Conway
SCALE10X-PGDay
Overview Function Basics
By Example
How are they Used?
Introduction Uses Varieties Languages
Functions Operators Data types Index methods Casts Triggers Aggregates
Joe Conway
SCALE10X-PGDay
Overview Function Basics
By Example
Introduction Uses Varieties Languages
What Forms Can They Take?
PostgreSQL provides four kinds of functions: SQL Procedural Languages Internal C-language
Arguments Base, composite, or combinations Scalar or array Pseudo or polymorphic VARIADIC IN/OUT/INOUT
Return Singleton or set (SETOF) Base or composite type Pseudo or polymorphic
createfunction.html
Joe Conway
SCALE10X-PGDay
SQL Functions
Overview Function Basics
By Example
Introduction Uses Varieties Languages
Behavior Executes an arbitrary list of SQL statements separated by semicolons Last statement may be INSERT, UPDATE, or DELETE with RETURNING clause
Arguments Referenced by function body using $n: $1 is first arg, etc. . . If composite type, then dot notation $1.name used to access Only used as data values, not as identifiers
Return If singleton, first row of last query result returned, NULL on no result If SETOF, all rows of last query result returned, empty set on no result
sql.html
Joe Conway
SCALE10X-PGDay
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- how to reset a postgresql password
- psql quick reference pivotal
- python postgresql tutorial
- jit compiling sql queries in postgresql using llvm
- psql 8 3 cheatsheet postgres online
- postgresql tutorialspoint
- machine code caching in postgresql query jit compiler
- postgresql functions by example
- introduction to hacking postgresql
Related searches
- sas programming by example pdf
- piecewise functions step by step
- arguments by example speech ideas
- argument by example examples
- inverse functions step by step
- angular 2 by example pdf
- postgresql if not exist
- python functions example programs
- postgresql execute sql script
- postgresql execute format
- postgresql list users
- postgresql execute using