<varlistentry>
<term><parameter>connstr</parameter></term>
<listitem>
- <para>
- <application>libpq</>-style connection info string, for example
+ <para><application>libpq</>-style connection info string, for example
<literal>hostaddr=127.0.0.1 port=5432 dbname=mydb user=postgres
password=mypasswd</>.
For details see <function>PQconnectdb</> in
AS t1(proname name, prosrc text);
SELECT * FROM myremote_pg_proc WHERE proname LIKE 'bytea%';
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
To abort all changes:
<programlisting>
ABORT;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<type>integer</type> into schema <literal>myschema</literal>:
<programlisting>
ALTER AGGREGATE myavg(integer) SET SCHEMA myschema;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<literal>joe</literal>:
<programlisting>
ALTER COLLATION "en_US" OWNER TO joe;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<literal>joe</literal>:
<programlisting>
ALTER CONVERSION iso_8859_1_to_utf8 OWNER TO joe;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<programlisting>
ALTER DATABASE test SET enable_indexscan TO off;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<programlisting>
ALTER DEFAULT PRIVILEGES FOR ROLE admin REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
To move the domain into a different schema:
<programlisting>
ALTER DOMAIN zipcode SET SCHEMA customers;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1 id="SQL-ALTERDOMAIN-compatibility">
To add an existing function to the <literal>hstore</literal> extension:
<programlisting>
ALTER EXTENSION hstore ADD FUNCTION populate_record(anyelement, hstore);
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1 id="SQL-ALTEREXTENSION-see-also">
to <literal>bob.myvalidator</>:
<programlisting>
ALTER FOREIGN DATA WRAPPER dbi VALIDATOR bob.myvalidator;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
To change options of a foreign table:
<programlisting>
ALTER FOREIGN TABLE myschema.distributors OPTIONS (ADD opt1 'value', SET opt2, 'value2', DROP opt3 'value3');
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<term><literal>STRICT</literal></term>
<listitem>
- <para>
- <literal>CALLED ON NULL INPUT</literal> changes the function so
+ <para><literal>CALLED ON NULL INPUT</literal> changes the function so
that it will be invoked when some or all of its arguments are
null. <literal>RETURNS NULL ON NULL INPUT</literal> or
<literal>STRICT</literal> changes the function so that it is not
<programlisting>
ALTER GROUP workers DROP USER beth;
-</programlisting>
-
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<programlisting>
ALTER INDEX distributors SET (fillfactor = 75);
REINDEX INDEX distributors;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
Change the owner of a custom operator <literal>a @@ b</literal> for type <type>text</type>:
<programlisting>
ALTER OPERATOR @@ (text, text) OWNER TO joe;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<programlisting>
ALTER ROLE fred IN DATABASE devel SET client_min_messages = DEBUG;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
Restart a sequence called <literal>serial</literal>, at 105:
<programlisting>
ALTER SEQUENCE serial RESTART WITH 105;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
change <literal>host</> option:
<programlisting>
ALTER SERVER foo VERSION '8.4' OPTIONS (SET host 'baz');
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
CREATE UNIQUE INDEX CONCURRENTLY dist_id_temp_idx ON distributors (dist_id);
ALTER TABLE distributors DROP CONSTRAINT distributors_pkey,
ADD CONSTRAINT distributors_pkey PRIMARY KEY USING INDEX dist_id_temp_idx;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
Change the owner of tablespace <literal>index_space</literal>:
<programlisting>
ALTER TABLESPACE index_space OWNER TO mary;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
To rename an existing trigger:
<programlisting>
ALTER TRIGGER emp_stamp ON emp RENAME TO emp_track_chgs;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
To add a new value to an enum type in a particular sort position:
<programlisting>
ALTER TYPE colors ADD VALUE 'orange' AFTER 'red';
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
Change the password for user mapping <literal>bob</>, server<literal> foo</>:
<programlisting>
ALTER USER MAPPING FOR bob SERVER foo OPTIONS (user 'bob', password 'public');
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<literal>bar</literal>:
<programlisting>
ALTER VIEW foo RENAME TO bar;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<programlisting>
BEGIN;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
Close the cursor <literal>liahona</literal>:
<programlisting>
CLOSE liahona;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
Cluster all tables in the database that have previously been clustered:
<programlisting>
CLUSTER;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<literal>xyzzy</literal>:
<screen>
<prompt>$ </prompt><userinput>clusterdb --table foo xyzzy</userinput>
-</screen>
- </para>
+</screen></para>
</refsect1>
COMMENT ON TRIGGER my_trigger ON my_table IS 'Used for RI';
COMMENT ON TYPE complex IS 'Complex number data type';
COMMENT ON VIEW my_view IS 'View of departmental costs';
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
To commit the current transaction and make all changes permanent:
<programlisting>
COMMIT;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<programlisting>
COMMIT PREPARED 'foobar';
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
</para>
</listitem>
</varlistentry>
- </variablelist>
- </para>
+ </variablelist></para>
</listitem>
</varlistentry>
0000140 \0 002 Z M \0 \0 \0 006 Z A M B I A 377 377
0000160 377 377 \0 003 \0 \0 \0 002 Z W \0 \0 \0 \b Z I
0000200 M B A B W E 377 377 377 377 377 377
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
TO { '<replaceable class="parameter">filename</replaceable>' | STDOUT }
[ [USING] DELIMITERS '<replaceable class="parameter">delimiter</replaceable>' ]
[ WITH NULL AS '<replaceable class="parameter">null string</replaceable>' ]
-</synopsis>
- </para>
+</synopsis></para>
</refsect1>
</refentry>
internal, -- destination (fill with a null terminated C string)
integer -- source string length
) RETURNS void;
-</programlisting>
- </para>
+</programlisting></para>
</listitem>
</varlistentry>
</variablelist>
<literal>LATIN1</literal> using <function>myfunc</>:
<programlisting>
CREATE CONVERSION myconv FOR 'UTF8' TO 'LATIN1' FROM myfunc;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<varlistentry>
<term><literal>CHECK (<replaceable class="PARAMETER">expression</replaceable>)</literal></term>
<listitem>
- <para>
- <literal>CHECK</> clauses specify integrity constraints or tests
+ <para><literal>CHECK</> clauses specify integrity constraints or tests
which values of the domain must satisfy.
Each constraint must be an expression
producing a Boolean result. It should use the key word <literal>VALUE</>
city TEXT NOT NULL,
postal us_postal_code NOT NULL
);
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1 id="SQL-CREATEDOMAIN-compatibility">
<varlistentry>
<term><replaceable class="parameter">old_version</replaceable></term>
<listitem>
- <para>
- <literal>FROM</> <replaceable class="parameter">old_version</>
+ <para><literal>FROM</> <replaceable class="parameter">old_version</>
must be specified when, and only when, you are attempting to install
an extension that replaces an <quote>old style</> module that is just
a collection of objects not packaged into an extension. This option
<varlistentry>
<term><literal>HANDLER <replaceable class="parameter">handler_function</replaceable></literal></term>
<listitem>
- <para>
- <replaceable class="parameter">handler_function</replaceable> is the
+ <para><replaceable class="parameter">handler_function</replaceable> is the
name of a previously registered function that will be called to
retrieve the execution functions for foreign tables.
The handler function must take no arguments, and
<varlistentry>
<term><literal>VALIDATOR <replaceable class="parameter">validator_function</replaceable></literal></term>
<listitem>
- <para>
- <replaceable class="parameter">validator_function</replaceable> is the
+ <para><replaceable class="parameter">validator_function</replaceable> is the
name of a previously registered function that will be called to
check the generic options given to the foreign-data wrapper, as
well as options for foreign servers and user mappings using the
<programlisting>
CREATE FOREIGN DATA WRAPPER mywrapper
OPTIONS (debug 'true');
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
len interval hour to minute
)
SERVER film_server;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<term><literal>WINDOW</literal></term>
<listitem>
- <para>
- <literal>WINDOW</literal> indicates that the function is a
+ <para><literal>WINDOW</literal> indicates that the function is a
<firstterm>window function</> rather than a plain function.
This is currently only useful for functions written in C.
The <literal>WINDOW</> attribute cannot be changed when
<literal>VOLATILE</literal> is the default assumption.
</para>
- <para>
- <literal>IMMUTABLE</literal> indicates that the function
+ <para><literal>IMMUTABLE</literal> indicates that the function
cannot modify the database and always
returns the same result when given the same argument values; that
is, it does not do database lookups or otherwise use information not
immediately replaced with the function value.
</para>
- <para>
- <literal>STABLE</literal> indicates that the function
+ <para><literal>STABLE</literal> indicates that the function
cannot modify the database,
and that within a single table scan it will consistently
return the same result for the same argument values, but that its
as stable, since their values do not change within a transaction.
</para>
- <para>
- <literal>VOLATILE</literal> indicates that the function value can
+ <para><literal>VOLATILE</literal> indicates that the function value can
change even within a single table scan, so no optimizations can be
made. Relatively few database functions are volatile in this sense;
some examples are <literal>random()</>, <literal>currval()</>,
<term><literal>STRICT</literal></term>
<listitem>
- <para>
- <literal>CALLED ON NULL INPUT</literal> (the default) indicates
+ <para><literal>CALLED ON NULL INPUT</literal> (the default) indicates
that the function will be called normally when some of its
arguments are null. It is then the function author's
responsibility to check for null values if necessary and respond
appropriately.
</para>
- <para>
- <literal>RETURNS NULL ON NULL INPUT</literal> or
+ <para><literal>RETURNS NULL ON NULL INPUT</literal> or
<literal>STRICT</literal> indicates that the function always
returns null whenever any of its arguments are null. If this
parameter is specified, the function is not executed when there
<term><literal><optional>EXTERNAL</optional> SECURITY DEFINER</literal></term>
<listitem>
- <para>
- <literal>SECURITY INVOKER</literal> indicates that the function
+ <para><literal>SECURITY INVOKER</literal> indicates that the function
is to be executed with the privileges of the user that calls it.
That is the default. <literal>SECURITY DEFINER</literal>
specifies that the function is to be executed with the
<varlistentry>
<term><literal>isCachable</></term>
<listitem>
- <para>
- <literal>isCachable</literal> is an obsolete equivalent of
+ <para><literal>isCachable</literal> is an obsolete equivalent of
<literal>IMMUTABLE</literal>; it's still accepted for
backwards-compatibility reasons.
</para>
To create an index without locking out writes to the table:
<programlisting>
CREATE INDEX CONCURRENTLY sales_quantity_index ON sales_table (quantity);
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<term><literal>TRUSTED</literal></term>
<listitem>
- <para>
- <literal>TRUSTED</literal> specifies that the language does
+ <para><literal>TRUSTED</literal> specifies that the language does
not grant access to data that the user would not otherwise
have. If this key word is omitted
when registering the language, only users with the
<term><literal>HANDLER</literal> <replaceable class="parameter">call_handler</replaceable></term>
<listitem>
- <para>
- <replaceable class="parameter">call_handler</replaceable> is
+ <para><replaceable class="parameter">call_handler</replaceable> is
the name of a previously registered function that will be
called to execute the procedural language's functions. The call
handler for a procedural language must be written in a compiled
<term><literal>INLINE</literal> <replaceable class="parameter">inline_handler</replaceable></term>
<listitem>
- <para>
- <replaceable class="parameter">inline_handler</replaceable> is the
+ <para><replaceable class="parameter">inline_handler</replaceable> is the
name of a previously registered function that will be called
to execute an anonymous code block
(<xref linkend="sql-do"> command)
<term><literal>VALIDATOR</literal> <replaceable class="parameter">valfunction</replaceable></term>
<listitem>
- <para>
- <replaceable class="parameter">valfunction</replaceable> is the
+ <para><replaceable class="parameter">valfunction</replaceable> is the
name of a previously registered function that will be called
when a new function in the language is created, to validate the
new function.
LANGUAGE C;
CREATE LANGUAGE plsample
HANDLER plsample_call_handler;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1 id="sql-createlanguage-compat">
There are a few restrictions on your choice of name:
<itemizedlist>
<listitem>
- <para>
- <literal>--</literal> and <literal>/*</literal> cannot appear anywhere in an operator name,
+ <para><literal>--</literal> and <literal>/*</literal> cannot appear anywhere in an operator name,
since they will be taken as the start of a comment.
</para>
</listitem>
arguments, use the <literal>OPERATOR()</> syntax, for example:
<programlisting>
COMMUTATOR = OPERATOR(myschema.===) ,
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
JOIN = area_join_procedure,
HASHES, MERGES
);
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<varlistentry>
<term><literal>IN GROUP</> <replaceable class="parameter">role_name</replaceable></term>
<listitem>
- <para>
- <literal>IN GROUP</literal> is an obsolete spelling of
+ <para><literal>IN GROUP</literal> is an obsolete spelling of
<literal>IN ROLE</>.
</para>
</listitem>
Create a role that can create databases and manage roles:
<programlisting>
CREATE ROLE admin WITH CREATEDB CREATEROLE;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<varlistentry>
<term><option>INSTEAD</option></term>
<listitem>
- <para>
- <literal>INSTEAD</literal> indicates that the commands should be
+ <para><literal>INSTEAD</literal> indicates that the commands should be
executed <emphasis>instead of</> the original command.
</para>
</listitem>
<varlistentry>
<term><option>ALSO</option></term>
<listitem>
- <para>
- <literal>ALSO</literal> indicates that the commands should be
+ <para><literal>ALSO</literal> indicates that the commands should be
executed <emphasis>in addition to</emphasis> the original
command.
</para>
CREATE TABLE hollywood.films (title text, release date, awards text[]);
CREATE VIEW hollywood.winners AS
SELECT title, release FROM hollywood.films WHERE awards IS NOT NULL;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
COPY distributors FROM 'input_file';
SELECT setval('serial', max(id)) FROM distributors;
END;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
extension.
</para>
</listitem>
- </itemizedlist>
- </para>
+ </itemizedlist></para>
</refsect1>
<refsect1>
foreign-data wrapper <literal>pgsql</>:
<programlisting>
CREATE SERVER myserver FOREIGN DATA WRAPPER pgsql OPTIONS (host 'foo', dbname 'foodb', port '5432');
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
error will be reported.
</para>
- <para>
- <literal>CHECK</> constraints are merged in essentially the same way as
+ <para><literal>CHECK</> constraints are merged in essentially the same way as
columns: if multiple parent tables and/or the new table definition
contain identically-named <literal>CHECK</> constraints, these
constraints must all have the same check expression, or an error will be
table, unless the <literal>INCLUDING INDEXES</literal> clause is
specified.
</para>
- <para>
- <literal>STORAGE</> settings for the copied column definitions will only
+ <para><literal>STORAGE</> settings for the copied column definitions will only
be copied if <literal>INCLUDING STORAGE</literal> is specified. The
default behavior is to exclude <literal>STORAGE</> settings, resulting
in the copied columns in the new table having type-specific default
is specified. The default behavior is to exclude comments, resulting in
the copied columns and constraints in the new table having no comments.
</para>
- <para>
- <literal>INCLUDING ALL</literal> is an abbreviated form of
+ <para><literal>INCLUDING ALL</literal> is an abbreviated form of
<literal>INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES INCLUDING STORAGE INCLUDING COMMENTS</literal>.
</para>
<para>
</para>
</listitem>
</varlistentry>
- </variablelist>
- </para>
+ </variablelist></para>
</listitem>
</varlistentry>
kind varchar(10),
len interval hour to minute
);
-</programlisting>
-<programlisting>
CREATE TABLE distributors (
did integer PRIMARY KEY DEFAULT nextval('serial'),
name varchar(40) NOT NULL CHECK (name <> '')
name varchar(40),
PRIMARY KEY(did)
);
-</programlisting>
-<programlisting>
CREATE TABLE distributors (
did integer PRIMARY KEY,
name varchar(40)
PRIMARY KEY (name),
salary WITH OPTIONS DEFAULT 1000
);
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1 id="SQL-CREATETABLE-compatibility">
</para>
</listitem>
</varlistentry>
- </variablelist>
- </para>
+ </variablelist></para>
</listitem>
</varlistentry>
SELECT * FROM films WHERE date_prod > $1;
CREATE TEMP TABLE films_recent WITH (OIDS) ON COMMIT DROP AS
EXECUTE recentfilms('2002-01-01');
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
</listitem>
<listitem>
- <para>
- <productname>PostgreSQL</> handles temporary tables in a way
+ <para><productname>PostgreSQL</> handles temporary tables in a way
rather different from the standard; see
<xref linkend="sql-createtable">
for details.
is an extension.
</para>
</listitem>
- </itemizedlist>
- </para>
+ </itemizedlist></para>
</refsect1>
<refsect1>
owned by user <literal>genevieve</>:
<programlisting>
CREATE TABLESPACE indexspace OWNER genevieve LOCATION '/data/indexes';
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
is mentioned as a target of the <command>UPDATE</> command.
</para>
- <para>
- <literal>INSTEAD OF UPDATE</> events do not support lists of columns.
+ <para><literal>INSTEAD OF UPDATE</> events do not support lists of columns.
</para>
</listitem>
</varlistentry>
and <literal>DELETE</> triggers cannot refer to <literal>NEW</>.
</para>
- <para>
- <literal>INSTEAD OF</> triggers do not support <literal>WHEN</>
+ <para><literal>INSTEAD OF</> triggers do not support <literal>WHEN</>
conditions.
</para>
</listitem>
<listitem>
- <para>
- <productname>PostgreSQL</productname> only allows the execution
+ <para><productname>PostgreSQL</productname> only allows the execution
of a user-defined function for the triggered action. The standard
allows the execution of a number of other SQL commands, such as
<command>CREATE TABLE</command>, as the triggered action. This
Create a user mapping for user <literal>bob</>, server <literal>foo</>:
<programlisting>
CREATE USER MAPPING FOR bob SERVER foo OPTIONS (user 'bob', password 'secret');
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<screen>
<prompt>$ </prompt><userinput>createdb -p 5000 -h eden -E LATIN1 -e demo</userinput>
<computeroutput>CREATE DATABASE demo ENCODING 'LATIN1';</computeroutput>
-</screen>
- </para>
+</screen></para>
</refsect1>
<term><literal>SCROLL</literal></term>
<term><literal>NO SCROLL</literal></term>
<listitem>
- <para>
- <literal>SCROLL</literal> specifies that the cursor can be used
+ <para><literal>SCROLL</literal> specifies that the cursor can be used
to retrieve rows in a nonsequential fashion (e.g.,
backward). Depending upon the complexity of the query's
execution plan, specifying <literal>SCROLL</literal> might impose
<term><literal>WITH HOLD</literal></term>
<term><literal>WITHOUT HOLD</literal></term>
<listitem>
- <para>
- <literal>WITH HOLD</literal> specifies that the cursor can
+ <para><literal>WITH HOLD</literal> specifies that the cursor can
continue to be used after the transaction that created it
successfully commits. <literal>WITHOUT HOLD</literal> specifies
that the cursor cannot be used outside of the transaction that
<literal>c_tasks</> is currently positioned:
<programlisting>
DELETE FROM tasks WHERE CURRENT OF c_tasks;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
SELECT pg_advisory_unlock_all();
DISCARD PLANS;
DISCARD TEMP;
-</programlisting>
- </para>
+</programlisting></para>
</listitem>
</varlistentry>
EXECUTE 'GRANT ALL ON ' || quote_ident(r.table_schema) || '.' || quote_ident(r.table_name) || ' TO webuser';
END LOOP;
END$$;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
+
<refsect1>
<title>Compatibility</title>
<type>integer</type>:
<programlisting>
DROP AGGREGATE myavg(integer);
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
To drop the cast from type <type>text</type> to type <type>int</type>:
<programlisting>
DROP CAST (text AS int);
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1 id="sql-dropcast-compat">
To drop the collation named <literal>german</>:
<programlisting>
DROP COLLATION german;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1 id="sql-dropcollation-compat">
To drop the conversion named <literal>myname</>:
<programlisting>
DROP CONVERSION myname;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1 id="sql-dropconversion-compat">
<programlisting>
DROP DOMAIN box;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1 id="SQL-DROPDOMAIN-compatibility">
Drop the foreign-data wrapper <literal>dbi</>:
<programlisting>
DROP FOREIGN DATA WRAPPER dbi;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<programlisting>
DROP FOREIGN TABLE films, distributors;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<programlisting>
DROP FUNCTION sqrt(integer);
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1 id="SQL-DROPFUNCTION-compatibility">
<programlisting>
DROP INDEX title_idx;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<programlisting>
DROP LANGUAGE plsample;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
for type <type>bigint</type>:
<programlisting>
DROP OPERATOR ! (bigint, none);
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
To drop a role:
<programlisting>
DROP ROLE jonathan;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<programlisting>
DROP RULE newrule ON mytable;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<programlisting>
DROP SCHEMA mystuff CASCADE;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<programlisting>
DROP SEQUENCE serial;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
Drop a server <literal>foo</> if it exists:
<programlisting>
DROP SERVER IF EXISTS foo;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<programlisting>
DROP TABLE films, distributors;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
To remove tablespace <literal>mystuff</literal> from the system:
<programlisting>
DROP TABLESPACE mystuff;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<programlisting>
DROP TRIGGER if_dist_exists ON films;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1 id="SQL-DROPTRIGGER-compatibility">
To remove the data type <type>box</type>:
<programlisting>
DROP TYPE box;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1 id="SQL-DROPTYPE-compatibility">
Drop a user mapping <literal>bob</>, server <literal>foo</> if it exists:
<programlisting>
DROP USER MAPPING IF EXISTS FOR bob SERVER foo;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
This command will remove the view called <literal>kinds</literal>:
<programlisting>
DROP VIEW kinds;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<computeroutput>Database "demo" will be permanently deleted.
Are you sure? (y/n) </computeroutput><userinput>y</userinput>
<computeroutput>DROP DATABASE demo;</computeroutput>
-</screen>
- </para>
+</screen></para>
</refsect1>
To remove the language <literal>pltcl</literal>:
<screen>
<prompt>$ </prompt><userinput>droplang pltcl dbname</userinput>
-</screen>
- </para>
+</screen></para>
</refsect1>
<refsect1>
<computeroutput>Role "joe" will be permanently removed.
Are you sure? (y/n) </computeroutput><userinput>y</userinput>
<computeroutput>DROP ROLE joe;</computeroutput>
-</screen>
- </para>
+</screen></para>
</refsect1>
</para>
</listitem>
</varlistentry>
- </variablelist>
- </para>
+ </variablelist></para>
</listitem>
</varlistentry>
ecpg prog1.pgc
cc -I/usr/local/pgsql/include -c prog1.c
cc -o prog1 prog1.o -L/usr/local/pgsql/lib -lecpg
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
</refentry>
To commit the current transaction and make all changes permanent:
<programlisting>
END;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<varlistentry>
<term><replaceable class="PARAMETER">direction</replaceable></term>
<listitem>
- <para>
- <replaceable class="PARAMETER">direction</replaceable> defines
+ <para><replaceable class="PARAMETER">direction</replaceable> defines
the fetch direction and number of rows to fetch. It can be one
of the following:
</para>
</listitem>
</varlistentry>
- </variablelist>
- </para>
+ </variablelist></para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">count</replaceable></term>
<listitem>
- <para>
- <replaceable class="PARAMETER">count</replaceable> is a
+ <para><replaceable class="PARAMETER">count</replaceable> is a
possibly-signed integer constant, determining the location or
number of rows to fetch. For <literal>FORWARD</> and
<literal>BACKWARD</> cases, specifying a negative <replaceable
-- Close the cursor and end the transaction:
CLOSE liahona;
COMMIT WORK;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<programlisting>
GRANT admins TO joe;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1 id="sql-grant-compatibility">
RETURNING *
)
INSERT INTO employees_log SELECT *, current_timestamp FROM upd;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
LISTEN virtual;
NOTIFY virtual;
Asynchronous notification "virtual" received from server process with PID 8448.
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
(SELECT id FROM films WHERE rating < 5);
DELETE FROM films WHERE rating < 5;
COMMIT WORK;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
LISTEN foo;
SELECT pg_notify('fo' || 'o', 'pay' || 'load');
Asynchronous notification "foo" with payload "payload" received from server process with PID 14728.
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
</para>
</listitem>
</varlistentry>
- </variablelist>
- </para>
+ </variablelist></para>
</listitem>
</varlistentry>
running without <function>fsync</function>, use:
<screen>
<prompt>$</prompt> <userinput>pg_ctl -o "-F -p 5433" start</userinput>
-</screen>
- </para>
+</screen></para>
</refsect2>
<refsect2 id="R2-APP-PGCTL-4">
<emphasis>how</emphasis> the server shuts down:
<screen>
<prompt>$</prompt> <userinput>pg_ctl stop -m fast</userinput>
-</screen>
- </para>
+</screen></para>
</refsect2>
<refsect2 id="R2-APP-PGCTL-5">
To restart using port 5433, disabling <function>fsync</> upon restart:
<screen>
<prompt>$</prompt> <userinput>pg_ctl -o "-F -p 5433" restart</userinput>
-</screen>
- </para>
+</screen></para>
</refsect2>
<refsect2 id="R2-APP-PGCTL-6">
</para>
</listitem>
</varlistentry>
-
- </variablelist>
- </para>
-
+ </variablelist></para>
</listitem>
</varlistentry>
<screen>
<prompt>$</prompt> <userinput>pg_dump -t '"MixedCaseName"' mydb > mytab.sql</userinput>
-</screen>
- </para>
+</screen></para>
</refsect1>
</para>
</listitem>
</varlistentry>
- </variablelist>
- </para>
+ </variablelist></para>
</listitem>
</varlistentry>
if filtering switches such as <option>-n</> or <option>-t</> are
used with <option>-L</>, they will further restrict the items restored.
</para>
- <para>
- <replaceable class="PARAMETER">list-file</> is normally created by
+ <para><replaceable class="PARAMETER">list-file</> is normally created by
editing the output of a previous <option>-l</> operation.
Lines can be moved or removed, and can also
be commented out by placing a semicolon (<literal>;</literal>) at the
</listitem>
<listitem>
- <para>
- <application>pg_restore</application> cannot restore large objects
+ <para><application>pg_restore</application> cannot restore large objects
selectively; for instance, only those for a specific table. If
an archive contains large objects, then all large objects will be
restored, or none of them if they are excluded via <option>-L</option>,
items 10 and 6, in that order:
<screen>
<prompt>$</prompt> <userinput>pg_restore -L db.list db.dump</userinput>
-</screen>
- </para>
+</screen></para>
</refsect1>
<programlisting>
PREPARE TRANSACTION 'foobar';
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
(<filename>psqlrc</filename> and <filename>~/.psqlrc</filename>) are
ignored with this option.
</para>
- <para>
- <replaceable class="parameter">command</replaceable> must be either
+ <para><replaceable class="parameter">command</replaceable> must be either
a command string that is completely parsable by the server (i.e.,
it contains no <application>psql</application>-specific features),
or a single backslash command. Thus you cannot mix
backslash escapes do not apply.
</para>
- <para>
- <literal>\copy ... from stdin | to stdout</literal>
+ <para><literal>\copy ... from stdin | to stdout</literal>
reads/writes based on the command input and output respectively.
All rows are read from the same source that issued the command,
continuing until <literal>\.</literal> is read or the stream
specified, the query output will be reset to the standard output.
</para>
- <para>
- <quote>Query results</quote> includes all tables, command
+ <para><quote>Query results</quote> includes all tables, command
responses, and notices obtained from the database server, as
well as output of various backslash commands that query the
database (such as <command>\d</command>), but not error
is enough.)
</para>
- <para>
- <literal>unaligned</> format writes all columns of a row on one
+ <para><literal>unaligned</> format writes all columns of a row on one
line, separated by the currently active field separator. This
is useful for creating output that might be intended to be read
in by other programs (for example, tab-separated or comma-separated
format).
</para>
- <para>
- <literal>aligned</literal> format is the standard, human-readable,
+ <para><literal>aligned</literal> format is the standard, human-readable,
nicely formatted text output; this is the default.
</para>
- <para>
- <literal>wrapped</> format is like <literal>aligned</> but wraps
+ <para><literal>wrapped</> format is like <literal>aligned</> but wraps
wide data values across lines to make the output fit in the target
column width. The target width is determined as described under
the <literal>columns</> option. Note that <application>psql</> will
<literal>wrapped</> output formats.
</para>
- <para>
- <literal>ascii</literal> style uses plain <acronym>ASCII</acronym>
+ <para><literal>ascii</literal> style uses plain <acronym>ASCII</acronym>
characters. Newlines in data are shown using
a <literal>+</literal> symbol in the right-hand margin.
When the <literal>wrapped</literal> format wraps data from
and again in the left-hand margin of the following line.
</para>
- <para>
- <literal>old-ascii</literal> style uses plain <acronym>ASCII</>
+ <para><literal>old-ascii</literal> style uses plain <acronym>ASCII</>
characters, using the formatting style used
in <productname>PostgreSQL</productname> 8.4 and earlier.
Newlines in data are shown using a <literal>:</literal>
symbol is used in place of the left-hand column separator.
</para>
- <para>
- <literal>unicode</literal> style uses Unicode box-drawing characters.
+ <para><literal>unicode</literal> style uses Unicode box-drawing characters.
Newlines in data are shown using a carriage return symbol
in the right-hand margin. When the data is wrapped from one line
to the next without a newline character, an ellipsis symbol
<programlisting>
testdb=> <userinput>\echo :foo</userinput>
bar
-</programlisting>
- </para>
+</programlisting></para>
<note>
<para>
</listitem>
<listitem>
- <para>
- <application>psql</application> is only guaranteed to work smoothly
+ <para><application>psql</application> is only guaranteed to work smoothly
with servers of the same version. That does not mean other combinations
will fail outright, but subtle and not-so-subtle problems might come
up. Backslash commands are particularly likely to fail if the
raster font does not work with the ANSI code page.
</para>
</listitem>
- </itemizedlist>
- </para>
+ </itemizedlist></para>
</refsect1>
-[ RECORD 4 ]-
first | 4
second | four
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
</para>
</listitem>
- </itemizedlist>
- </para>
+ </itemizedlist></para>
</refsect1>
<refsect1>
...
broken_db=> REINDEX DATABASE broken_db;
broken_db=> \q
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<literal>bar</literal> in a database named <literal>abcd</literal>:
<screen>
<prompt>$ </prompt><userinput>reindexdb --table foo --index bar abcd</userinput>
-</screen>
- </para>
+</screen></para>
</refsect1>
Set the <varname>timezone</> configuration variable to its default value:
<screen>
RESET timezone;
-</screen>
- </para>
+</screen></para>
</refsect1>
<refsect1>
<programlisting>
REVOKE admins FROM joe;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1 id="SQL-REVOKE-compatibility">
To abort all changes:
<programlisting>
ROLLBACK;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<programlisting>
ROLLBACK PREPARED 'foobar';
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
2
COMMIT;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<programlisting>
SECURITY LABEL FOR selinux ON TABLE mytable IS 'system_u:object_r:sepgsql_table_t:s0';
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
</listitem>
<listitem>
- <para>
- <literal>SELECT DISTINCT</literal> eliminates duplicate rows from the
+ <para><literal>SELECT DISTINCT</literal> eliminates duplicate rows from the
result. <literal>SELECT DISTINCT ON</literal> eliminates rows that
match on all the specified expressions. <literal>SELECT ALL</literal>
(the default) will return all candidate rows, including
separating <literal>FROM</> items.
</para>
- <para>
- <literal>CROSS JOIN</> and <literal>INNER JOIN</literal>
+ <para><literal>CROSS JOIN</> and <literal>INNER JOIN</literal>
produce a simple Cartesian product, the same result as you get from
listing the two items at the top level of <literal>FROM</>,
but restricted by the join condition (if any).
<literal>WHERE</>.
</para>
- <para>
- <literal>LEFT OUTER JOIN</> returns all rows in the qualified
+ <para><literal>LEFT OUTER JOIN</> returns all rows in the qualified
Cartesian product (i.e., all combined rows that pass its join
condition), plus one copy of each row in the left-hand table
for which there was no right-hand row that passed the join
OUTER JOIN</> by switching the left and right inputs.
</para>
- <para>
- <literal>FULL OUTER JOIN</> returns all the joined rows, plus
+ <para><literal>FULL OUTER JOIN</> returns all the joined rows, plus
one row for each unmatched left-hand row (extended with nulls
on the right), plus one row for each unmatched right-hand row
(extended with nulls on the left).
<varlistentry>
<term><literal>ON <replaceable class="parameter">join_condition</replaceable></literal></term>
<listitem>
- <para>
- <replaceable class="parameter">join_condition</replaceable> is
+ <para><replaceable class="parameter">join_condition</replaceable> is
an expression resulting in a value of type
<type>boolean</type> (similar to a <literal>WHERE</literal>
clause) that specifies which rows in a join are considered to
<varlistentry>
<term><literal>NATURAL</literal></term>
<listitem>
- <para>
- <literal>NATURAL</literal> is shorthand for a
+ <para><literal>NATURAL</literal> is shorthand for a
<literal>USING</> list that mentions all columns in the two
tables that have the same names.
</para>
The <literal>UNION</literal> clause has this general form:
<synopsis>
<replaceable class="parameter">select_statement</replaceable> UNION [ ALL | DISTINCT ] <replaceable class="parameter">select_statement</replaceable>
-</synopsis>
- <replaceable class="parameter">select_statement</replaceable> is
+</synopsis><replaceable class="parameter">select_statement</replaceable> is
any <command>SELECT</command> statement without an <literal>ORDER
BY</>, <literal>LIMIT</>, <literal>FOR UPDATE</literal>, or
<literal>FOR SHARE</literal> clause.
The <literal>INTERSECT</literal> clause has this general form:
<synopsis>
<replaceable class="parameter">select_statement</replaceable> INTERSECT [ ALL | DISTINCT ] <replaceable class="parameter">select_statement</replaceable>
-</synopsis>
- <replaceable class="parameter">select_statement</replaceable> is
+</synopsis><replaceable class="parameter">select_statement</replaceable> is
any <command>SELECT</command> statement without an <literal>ORDER
BY</>, <literal>LIMIT</>, <literal>FOR UPDATE</literal>, or
<literal>FOR SHARE</literal> clause.
The <literal>EXCEPT</literal> clause has this general form:
<synopsis>
<replaceable class="parameter">select_statement</replaceable> EXCEPT [ ALL | DISTINCT ] <replaceable class="parameter">select_statement</replaceable>
-</synopsis>
- <replaceable class="parameter">select_statement</replaceable> is
+</synopsis><replaceable class="parameter">select_statement</replaceable> is
any <command>SELECT</command> statement without an <literal>ORDER
BY</>, <literal>LIMIT</>, <literal>FOR UPDATE</literal>, or
<literal>FOR SHARE</literal> clause.
<synopsis>
LIMIT { <replaceable class="parameter">count</replaceable> | ALL }
OFFSET <replaceable class="parameter">start</replaceable>
-</synopsis>
- <replaceable class="parameter">count</replaceable> specifies the
+</synopsis><replaceable class="parameter">count</replaceable> specifies the
maximum number of rows to return, while <replaceable
class="parameter">start</replaceable> specifies the number of rows
to skip before starting to return rows. When both are specified,
following query is invalid:
<programlisting>
SELECT distributors.* WHERE distributors.name = 'Westward';
-</programlisting>
- <productname>PostgreSQL</productname> releases prior to
+</programlisting><productname>PostgreSQL</productname> releases prior to
8.1 would accept queries of this form, and add an implicit entry
to the query's <literal>FROM</literal> clause for each table
referenced by the query. This is no longer allowed.
<programlisting>
SELECT * INTO films_recent FROM films WHERE date_prod >= '2002-01-01';
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<varlistentry>
<term><literal>SCHEMA</literal></term>
<listitem>
- <para>
- <literal>SET SCHEMA '<replaceable>value</>'</> is an alias for
+ <para><literal>SET SCHEMA '<replaceable>value</>'</> is an alias for
<literal>SET search_path TO <replaceable>value</></>. Only one
schema can be specified using this syntax.
</para>
<varlistentry>
<term><literal>NAMES</literal></term>
<listitem>
- <para>
- <literal>SET NAMES <replaceable>value</></> is an alias for
+ <para><literal>SET NAMES <replaceable>value</></> is an alias for
<literal>SET client_encoding TO <replaceable>value</></>.
</para>
</listitem>
<function>setseed</function>:
<programlisting>
SELECT setseed(<replaceable>value</replaceable>);
-</programlisting>
- </para>
+</programlisting></para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>TIME ZONE</literal></term>
<listitem>
- <para>
- <literal>SET TIME ZONE <replaceable>value</></> is an alias
+ <para><literal>SET TIME ZONE <replaceable>value</></> is an alias
for <literal>SET timezone TO <replaceable>value</></>. The
syntax <literal>SET TIME ZONE</literal> allows special syntax
for the time zone specification. Here are examples of valid
Set the time zone for Italy:
<screen>
SET TIME ZONE 'Europe/Rome';
-</screen>
- </para>
+</screen></para>
</refsect1>
<refsect1>
</para>
</listitem>
</varlistentry>
- </variablelist>
- </para>
+ </variablelist></para>
</listitem>
</varlistentry>
xmloption | content | Sets whether XML data in implicit parsing ...
zero_damaged_pages | off | Continues processing past damaged page headers.
(196 rows)
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<programlisting>
TRUNCATE othertable CASCADE;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
UNLISTEN virtual;
NOTIFY virtual;
-- no NOTIFY event is received
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<literal>c_films</> is currently positioned:
<programlisting>
UPDATE films SET kind = 'Dramatic' WHERE CURRENT OF c_films;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
INFO: analyzing "public.onek"
INFO: "onek": 36 pages, 1000 rows sampled, 1000 estimated total rows
VACUUM
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
<literal>bar</literal> of the table for the optimizer:
<screen>
<prompt>$ </prompt><userinput>vacuumdb --analyze --verbose --table 'foo(bar)' xyzzy</userinput>
-</screen>
- </para>
+</screen></para>
</refsect1>
<programlisting>
SELECT * FROM machines
WHERE ip_address IN (VALUES('192.168.0.1'::inet), ('192.168.0.10'), ('192.168.1.43'));
-</programlisting>
- </para>
+</programlisting></para>
<tip>
<para>
<refsect1>
<title>Compatibility</title>
- <para>
- <command>VALUES</command> conforms to the SQL standard.
+ <para><command>VALUES</command> conforms to the SQL standard.
<literal>LIMIT</literal> and <literal>OFFSET</literal> are
<productname>PostgreSQL</productname> extensions; see also
under <xref linkend="sql-select">.
TupleDesc tupdesc; /* row descriptor */
HeapTuple *vals; /* rows */
} SPITupleTable;
-</programlisting>
- <structfield>vals</> is an array of pointers to rows. (The number
+</programlisting><structfield>vals</> is an array of pointers to rows. (The number
of valid entries is given by <varname>SPI_processed</varname>.)
<structfield>tupdesc</> is a row descriptor which you can pass to
SPI functions dealing with rows. <structfield>tuptabcxt</>,
<varlistentry>
<term><literal>bool <parameter>read_only</parameter></literal></term>
<listitem>
- <para>
- <literal>true</> for read-only execution
- </para>
+ <para><literal>true</> for read-only execution</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>bool <parameter>read_only</parameter></literal></term>
<listitem>
- <para>
- <literal>true</> for read-only execution
- </para>
+ <para><literal>true</> for read-only execution</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>bool <parameter>read_only</parameter></literal></term>
<listitem>
- <para>
- <literal>true</> for read-only execution
- </para>
+ <para><literal>true</> for read-only execution</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>bool <parameter>read_only</parameter></literal></term>
<listitem>
- <para>
- <literal>true</> for read-only execution
- </para>
+ <para><literal>true</> for read-only execution</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>bool <parameter>read_only</parameter></literal></term>
<listitem>
- <para>
- <literal>true</> for read-only execution
- </para>
+ <para><literal>true</> for read-only execution</para>
</listitem>
</varlistentry>
</variablelist>
<varlistentry>
<term><literal>bool <parameter>read_only</parameter></literal></term>
<listitem>
- <para>
- <literal>true</> for read-only execution
- </para>
+ <para><literal>true</> for read-only execution</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>bool <parameter>read_only</parameter></literal></term>
<listitem>
- <para>
- <literal>true</> for read-only execution
- </para>
+ <para><literal>true</> for read-only execution</para>
</listitem>
</varlistentry>
</variablelist>
<xsl:import href="stylesheet-common.xsl" />
-<!-- The following is a workaround for what may actually be a mistake
- in our markup. The problem is in a situation like
-
-<para>
- <command>FOO</command> is ...
-
- there is strictly speaking a line break before "FOO". In the
- HTML output, this does not appear to be a problem, but in the man
- page output, this shows up. Using this setting, pure whitespace
- text nodes are removed, so the problem is solved. -->
-<xsl:strip-space elements="para"/>
-
-
<!-- Parameters -->
<xsl:param name="man.authors.section.enabled">0</xsl:param>