Commit 20f7f019 authored by Peter Eisentraut's avatar Peter Eisentraut

Easier to translate psql help

Instead of requiring translators to translate the entire SQL command
synopses, change create_help.pl to only require them to translate the
placeholders, and paste those into the synopsis using a printf mechanism.
Make some small updates to the markup to make it easier to parse.

Note: This causes msgmerge of gettext 0.17 to segfault.  You will need
the patch from https://savannah.gnu.org/bugs/?27474 to make it work.
msgmerge usually only runs on babel.postgresql.org, however.
parent ef961960
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_database.sgml,v 1.22 2008/11/14 10:22:45 petere Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/alter_database.sgml,v 1.23 2009/09/18 05:00:41 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -23,7 +23,7 @@ PostgreSQL documentation ...@@ -23,7 +23,7 @@ PostgreSQL documentation
<synopsis> <synopsis>
ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ] ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ]
where <replaceable class="PARAMETER">option</replaceable> can be: <phrase>where <replaceable class="PARAMETER">option</replaceable> can be:</phrase>
CONNECTION LIMIT <replaceable class="PARAMETER">connlimit</replaceable> CONNECTION LIMIT <replaceable class="PARAMETER">connlimit</replaceable>
......
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_function.sgml,v 1.17 2008/11/14 10:22:45 petere Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/alter_function.sgml,v 1.18 2009/09/18 05:00:41 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -30,7 +30,7 @@ ALTER FUNCTION <replaceable>name</replaceable> ( [ [ <replaceable class="paramet ...@@ -30,7 +30,7 @@ ALTER FUNCTION <replaceable>name</replaceable> ( [ [ <replaceable class="paramet
ALTER FUNCTION <replaceable>name</replaceable> ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ALTER FUNCTION <replaceable>name</replaceable> ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] )
SET SCHEMA <replaceable>new_schema</replaceable> SET SCHEMA <replaceable>new_schema</replaceable>
where <replaceable class="PARAMETER">action</replaceable> is one of: <phrase>where <replaceable class="PARAMETER">action</replaceable> is one of:</phrase>
CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT
IMMUTABLE | STABLE | VOLATILE IMMUTABLE | STABLE | VOLATILE
......
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_role.sgml,v 1.12 2009/03/28 03:26:02 momjian Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/alter_role.sgml,v 1.13 2009/09/18 05:00:41 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -23,7 +23,7 @@ PostgreSQL documentation ...@@ -23,7 +23,7 @@ PostgreSQL documentation
<synopsis> <synopsis>
ALTER ROLE <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ] ALTER ROLE <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ]
where <replaceable class="PARAMETER">option</replaceable> can be: <phrase>where <replaceable class="PARAMETER">option</replaceable> can be:</phrase>
SUPERUSER | NOSUPERUSER SUPERUSER | NOSUPERUSER
| CREATEDB | NOCREATEDB | CREATEDB | NOCREATEDB
......
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.108 2009/08/02 22:14:51 tgl Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.109 2009/09/18 05:00:41 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -30,7 +30,7 @@ ALTER TABLE <replaceable class="PARAMETER">name</replaceable> ...@@ -30,7 +30,7 @@ ALTER TABLE <replaceable class="PARAMETER">name</replaceable>
ALTER TABLE <replaceable class="PARAMETER">name</replaceable> ALTER TABLE <replaceable class="PARAMETER">name</replaceable>
SET SCHEMA <replaceable class="PARAMETER">new_schema</replaceable> SET SCHEMA <replaceable class="PARAMETER">new_schema</replaceable>
where <replaceable class="PARAMETER">action</replaceable> is one of: <phrase>where <replaceable class="PARAMETER">action</replaceable> is one of:</phrase>
ADD [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> <replaceable class="PARAMETER">type</replaceable> [ <replaceable class="PARAMETER">column_constraint</replaceable> [ ... ] ] ADD [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> <replaceable class="PARAMETER">type</replaceable> [ <replaceable class="PARAMETER">column_constraint</replaceable> [ ... ] ]
DROP [ COLUMN ] [ IF EXISTS ] <replaceable class="PARAMETER">column</replaceable> [ RESTRICT | CASCADE ] DROP [ COLUMN ] [ IF EXISTS ] <replaceable class="PARAMETER">column</replaceable> [ RESTRICT | CASCADE ]
......
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_user.sgml,v 1.45 2008/11/14 10:22:45 petere Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/alter_user.sgml,v 1.46 2009/09/18 05:00:41 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -23,7 +23,7 @@ PostgreSQL documentation ...@@ -23,7 +23,7 @@ PostgreSQL documentation
<synopsis> <synopsis>
ALTER USER <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ] ALTER USER <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ]
where <replaceable class="PARAMETER">option</replaceable> can be: <phrase>where <replaceable class="PARAMETER">option</replaceable> can be:</phrase>
SUPERUSER | NOSUPERUSER SUPERUSER | NOSUPERUSER
| CREATEDB | NOCREATEDB | CREATEDB | NOCREATEDB
......
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/begin.sgml,v 1.37 2008/11/14 10:22:45 petere Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/begin.sgml,v 1.38 2009/09/18 05:00:41 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -23,7 +23,7 @@ PostgreSQL documentation ...@@ -23,7 +23,7 @@ PostgreSQL documentation
<synopsis> <synopsis>
BEGIN [ WORK | TRANSACTION ] [ <replaceable class="parameter">transaction_mode</replaceable> [, ...] ] BEGIN [ WORK | TRANSACTION ] [ <replaceable class="parameter">transaction_mode</replaceable> [, ...] ]
where <replaceable class="parameter">transaction_mode</replaceable> is one of: <phrase>where <replaceable class="parameter">transaction_mode</replaceable> is one of:</phrase>
ISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED } ISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED }
READ WRITE | READ ONLY READ WRITE | READ ONLY
......
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/create_domain.sgml,v 1.32 2008/11/14 10:22:46 petere Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/create_domain.sgml,v 1.33 2009/09/18 05:00:41 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -22,10 +22,10 @@ PostgreSQL documentation ...@@ -22,10 +22,10 @@ PostgreSQL documentation
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE DOMAIN <replaceable class="parameter">name</replaceable> [ AS ] <replaceable class="parameter">data_type</replaceable> CREATE DOMAIN <replaceable class="parameter">name</replaceable> [ AS ] <replaceable class="parameter">data_type</replaceable>
[ DEFAULT <replaceable>expression</> ] [ DEFAULT <replaceable>expression</replaceable> ]
[ <replaceable class="PARAMETER">constraint</replaceable> [ ... ] ] [ <replaceable class="PARAMETER">constraint</replaceable> [ ... ] ]
where <replaceable class="PARAMETER">constraint</replaceable> is: <phrase>where <replaceable class="PARAMETER">constraint</replaceable> is:</phrase>
[ CONSTRAINT <replaceable class="PARAMETER">constraint_name</replaceable> ] [ CONSTRAINT <replaceable class="PARAMETER">constraint_name</replaceable> ]
{ NOT NULL | NULL | CHECK (<replaceable class="PARAMETER">expression</replaceable>) } { NOT NULL | NULL | CHECK (<replaceable class="PARAMETER">expression</replaceable>) }
......
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/create_group.sgml,v 1.19 2008/11/14 10:22:46 petere Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/create_group.sgml,v 1.20 2009/09/18 05:00:41 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -23,7 +23,7 @@ PostgreSQL documentation ...@@ -23,7 +23,7 @@ PostgreSQL documentation
<synopsis> <synopsis>
CREATE GROUP <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ] CREATE GROUP <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ]
where <replaceable class="PARAMETER">option</replaceable> can be: <phrase>where <replaceable class="PARAMETER">option</replaceable> can be:</phrase>
SUPERUSER | NOSUPERUSER SUPERUSER | NOSUPERUSER
| CREATEDB | NOCREATEDB | CREATEDB | NOCREATEDB
......
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/create_role.sgml,v 1.11 2008/11/14 10:22:46 petere Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/create_role.sgml,v 1.12 2009/09/18 05:00:41 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -23,7 +23,7 @@ PostgreSQL documentation ...@@ -23,7 +23,7 @@ PostgreSQL documentation
<synopsis> <synopsis>
CREATE ROLE <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ] CREATE ROLE <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ]
where <replaceable class="PARAMETER">option</replaceable> can be: <phrase>where <replaceable class="PARAMETER">option</replaceable> can be:</phrase>
SUPERUSER | NOSUPERUSER SUPERUSER | NOSUPERUSER
| CREATEDB | NOCREATEDB | CREATEDB | NOCREATEDB
......
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/create_table.sgml,v 1.115 2009/07/29 20:56:17 tgl Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/create_table.sgml,v 1.116 2009/09/18 05:00:41 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -22,7 +22,7 @@ PostgreSQL documentation ...@@ -22,7 +22,7 @@ PostgreSQL documentation
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE <replaceable class="PARAMETER">table_name</replaceable> ( [ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE <replaceable class="PARAMETER">table_name</replaceable> ( [
{ <replaceable class="PARAMETER">column_name</replaceable> <replaceable class="PARAMETER">data_type</replaceable> [ DEFAULT <replaceable>default_expr</> ] [ <replaceable class="PARAMETER">column_constraint</replaceable> [ ... ] ] { <replaceable class="PARAMETER">column_name</replaceable> <replaceable class="PARAMETER">data_type</replaceable> [ DEFAULT <replaceable>default_expr</replaceable> ] [ <replaceable class="PARAMETER">column_constraint</replaceable> [ ... ] ]
| <replaceable>table_constraint</replaceable> | <replaceable>table_constraint</replaceable>
| LIKE <replaceable>parent_table</replaceable> [ { INCLUDING | EXCLUDING } { DEFAULTS | CONSTRAINTS | INDEXES } ] ... } | LIKE <replaceable>parent_table</replaceable> [ { INCLUDING | EXCLUDING } { DEFAULTS | CONSTRAINTS | INDEXES } ] ... }
[, ... ] [, ... ]
...@@ -32,7 +32,7 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE <replaceable class="PAR ...@@ -32,7 +32,7 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE <replaceable class="PAR
[ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ] [ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
[ TABLESPACE <replaceable class="PARAMETER">tablespace</replaceable> ] [ TABLESPACE <replaceable class="PARAMETER">tablespace</replaceable> ]
where <replaceable class="PARAMETER">column_constraint</replaceable> is: <phrase>where <replaceable class="PARAMETER">column_constraint</replaceable> is:</phrase>
[ CONSTRAINT <replaceable class="PARAMETER">constraint_name</replaceable> ] [ CONSTRAINT <replaceable class="PARAMETER">constraint_name</replaceable> ]
{ NOT NULL | { NOT NULL |
...@@ -44,7 +44,7 @@ where <replaceable class="PARAMETER">column_constraint</replaceable> is: ...@@ -44,7 +44,7 @@ where <replaceable class="PARAMETER">column_constraint</replaceable> is:
[ ON DELETE <replaceable class="parameter">action</replaceable> ] [ ON UPDATE <replaceable class="parameter">action</replaceable> ] } [ ON DELETE <replaceable class="parameter">action</replaceable> ] [ ON UPDATE <replaceable class="parameter">action</replaceable> ] }
[ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ] [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
and <replaceable class="PARAMETER">table_constraint</replaceable> is: <phrase>and <replaceable class="PARAMETER">table_constraint</replaceable> is:</phrase>
[ CONSTRAINT <replaceable class="PARAMETER">constraint_name</replaceable> ] [ CONSTRAINT <replaceable class="PARAMETER">constraint_name</replaceable> ]
{ UNIQUE ( <replaceable class="PARAMETER">column_name</replaceable> [, ... ] ) <replaceable class="PARAMETER">index_parameters</replaceable> | { UNIQUE ( <replaceable class="PARAMETER">column_name</replaceable> [, ... ] ) <replaceable class="PARAMETER">index_parameters</replaceable> |
...@@ -54,7 +54,7 @@ and <replaceable class="PARAMETER">table_constraint</replaceable> is: ...@@ -54,7 +54,7 @@ and <replaceable class="PARAMETER">table_constraint</replaceable> is:
[ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ] [ ON DELETE <replaceable class="parameter">action</replaceable> ] [ ON UPDATE <replaceable class="parameter">action</replaceable> ] } [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ] [ ON DELETE <replaceable class="parameter">action</replaceable> ] [ ON UPDATE <replaceable class="parameter">action</replaceable> ] }
[ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ] [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
<replaceable class="PARAMETER">index_parameters</replaceable> in <literal>UNIQUE</> and <literal>PRIMARY KEY</> constraints are: <phrase><replaceable class="PARAMETER">index_parameters</replaceable> in <literal>UNIQUE</literal> and <literal>PRIMARY KEY</literal> constraints are:</phrase>
[ WITH ( <replaceable class="PARAMETER">storage_parameter</replaceable> [= <replaceable class="PARAMETER">value</replaceable>] [, ... ] ) ] [ WITH ( <replaceable class="PARAMETER">storage_parameter</replaceable> [= <replaceable class="PARAMETER">value</replaceable>] [, ... ] ) ]
[ USING INDEX TABLESPACE <replaceable class="PARAMETER">tablespace</replaceable> ] [ USING INDEX TABLESPACE <replaceable class="PARAMETER">tablespace</replaceable> ]
......
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/create_user.sgml,v 1.41 2008/11/14 10:22:46 petere Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/create_user.sgml,v 1.42 2009/09/18 05:00:42 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -23,7 +23,7 @@ PostgreSQL documentation ...@@ -23,7 +23,7 @@ PostgreSQL documentation
<synopsis> <synopsis>
CREATE USER <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ] CREATE USER <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ]
where <replaceable class="PARAMETER">option</replaceable> can be: <phrase>where <replaceable class="PARAMETER">option</replaceable> can be:</phrase>
SUPERUSER | NOSUPERUSER SUPERUSER | NOSUPERUSER
| CREATEDB | NOCREATEDB | CREATEDB | NOCREATEDB
......
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/fetch.sgml,v 1.43 2009/04/10 17:56:21 tgl Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/fetch.sgml,v 1.44 2009/09/18 05:00:42 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -28,7 +28,7 @@ PostgreSQL documentation ...@@ -28,7 +28,7 @@ PostgreSQL documentation
<synopsis> <synopsis>
FETCH [ <replaceable class="PARAMETER">direction</replaceable> { FROM | IN } ] <replaceable class="PARAMETER">cursorname</replaceable> FETCH [ <replaceable class="PARAMETER">direction</replaceable> { FROM | IN } ] <replaceable class="PARAMETER">cursorname</replaceable>
where <replaceable class="PARAMETER">direction</replaceable> can be empty or one of: <phrase>where <replaceable class="PARAMETER">direction</replaceable> can be empty or one of:</phrase>
NEXT NEXT
PRIOR PRIOR
......
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/grant.sgml,v 1.75 2009/09/12 16:26:06 tgl Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/grant.sgml,v 1.76 2009/09/18 05:00:42 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -41,11 +41,11 @@ GRANT { { CREATE | CONNECT | TEMPORARY | TEMP } [,...] | ALL [ PRIVILEGES ] } ...@@ -41,11 +41,11 @@ GRANT { { CREATE | CONNECT | TEMPORARY | TEMP } [,...] | ALL [ PRIVILEGES ] }
TO { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ] TO { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
GRANT { USAGE | ALL [ PRIVILEGES ] } GRANT { USAGE | ALL [ PRIVILEGES ] }
ON FOREIGN DATA WRAPPER <replaceable>fdwname</> [, ...] ON FOREIGN DATA WRAPPER <replaceable>fdwname</replaceable> [, ...]
TO { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ] TO { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
GRANT { USAGE | ALL [ PRIVILEGES ] } GRANT { USAGE | ALL [ PRIVILEGES ] }
ON FOREIGN SERVER <replaceable>servername</> [, ...] ON FOREIGN SERVER <replaceable>servername</replaceable> [, ...]
TO { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ] TO { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
GRANT { EXECUTE | ALL [ PRIVILEGES ] } GRANT { EXECUTE | ALL [ PRIVILEGES ] }
...@@ -61,7 +61,7 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] } ...@@ -61,7 +61,7 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
TO { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ] TO { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
GRANT { CREATE | ALL [ PRIVILEGES ] } GRANT { CREATE | ALL [ PRIVILEGES ] }
ON TABLESPACE <replaceable>tablespacename</> [, ...] ON TABLESPACE <replaceable>tablespacename</replaceable> [, ...]
TO { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ] TO { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
GRANT <replaceable class="PARAMETER">role</replaceable> [, ...] TO <replaceable class="PARAMETER">rolename</replaceable> [, ...] [ WITH ADMIN OPTION ] GRANT <replaceable class="PARAMETER">role</replaceable> [, ...] TO <replaceable class="PARAMETER">rolename</replaceable> [, ...] [ WITH ADMIN OPTION ]
......
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/lock.sgml,v 1.52 2009/01/12 08:54:25 petere Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/lock.sgml,v 1.53 2009/09/18 05:00:42 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -23,7 +23,7 @@ PostgreSQL documentation ...@@ -23,7 +23,7 @@ PostgreSQL documentation
<synopsis> <synopsis>
LOCK [ TABLE ] [ ONLY ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ IN <replaceable class="PARAMETER">lockmode</replaceable> MODE ] [ NOWAIT ] LOCK [ TABLE ] [ ONLY ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ IN <replaceable class="PARAMETER">lockmode</replaceable> MODE ] [ NOWAIT ]
where <replaceable class="PARAMETER">lockmode</replaceable> is one of: <phrase>where <replaceable class="PARAMETER">lockmode</replaceable> is one of:</phrase>
ACCESS SHARE | ROW SHARE | ROW EXCLUSIVE | SHARE UPDATE EXCLUSIVE ACCESS SHARE | ROW SHARE | ROW EXCLUSIVE | SHARE UPDATE EXCLUSIVE
| SHARE | SHARE ROW EXCLUSIVE | EXCLUSIVE | ACCESS EXCLUSIVE | SHARE | SHARE ROW EXCLUSIVE | EXCLUSIVE | ACCESS EXCLUSIVE
......
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/select.sgml,v 1.124 2009/08/27 20:08:02 tgl Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/select.sgml,v 1.125 2009/09/18 05:00:42 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -47,7 +47,7 @@ SELECT [ ALL | DISTINCT [ ON ( <replaceable class="parameter">expression</replac ...@@ -47,7 +47,7 @@ SELECT [ ALL | DISTINCT [ ON ( <replaceable class="parameter">expression</replac
[ FETCH { FIRST | NEXT } [ <replaceable class="parameter">count</replaceable> ] { ROW | ROWS } ONLY ] [ FETCH { FIRST | NEXT } [ <replaceable class="parameter">count</replaceable> ] { ROW | ROWS } ONLY ]
[ FOR { UPDATE | SHARE } [ OF <replaceable class="parameter">table_name</replaceable> [, ...] ] [ NOWAIT ] [...] ] [ FOR { UPDATE | SHARE } [ OF <replaceable class="parameter">table_name</replaceable> [, ...] ] [ NOWAIT ] [...] ]
where <replaceable class="parameter">from_item</replaceable> can be one of: <phrase>where <replaceable class="parameter">from_item</replaceable> can be one of:</phrase>
[ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] [ [ AS ] <replaceable class="parameter">alias</replaceable> [ ( <replaceable class="parameter">column_alias</replaceable> [, ...] ) ] ] [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] [ [ AS ] <replaceable class="parameter">alias</replaceable> [ ( <replaceable class="parameter">column_alias</replaceable> [, ...] ) ] ]
( <replaceable class="parameter">select</replaceable> ) [ AS ] <replaceable class="parameter">alias</replaceable> [ ( <replaceable class="parameter">column_alias</replaceable> [, ...] ) ] ( <replaceable class="parameter">select</replaceable> ) [ AS ] <replaceable class="parameter">alias</replaceable> [ ( <replaceable class="parameter">column_alias</replaceable> [, ...] ) ]
...@@ -56,7 +56,7 @@ where <replaceable class="parameter">from_item</replaceable> can be one of: ...@@ -56,7 +56,7 @@ where <replaceable class="parameter">from_item</replaceable> can be one of:
<replaceable class="parameter">function_name</replaceable> ( [ <replaceable class="parameter">argument</replaceable> [, ...] ] ) AS ( <replaceable class="parameter">column_definition</replaceable> [, ...] ) <replaceable class="parameter">function_name</replaceable> ( [ <replaceable class="parameter">argument</replaceable> [, ...] ] ) AS ( <replaceable class="parameter">column_definition</replaceable> [, ...] )
<replaceable class="parameter">from_item</replaceable> [ NATURAL ] <replaceable class="parameter">join_type</replaceable> <replaceable class="parameter">from_item</replaceable> [ ON <replaceable class="parameter">join_condition</replaceable> | USING ( <replaceable class="parameter">join_column</replaceable> [, ...] ) ] <replaceable class="parameter">from_item</replaceable> [ NATURAL ] <replaceable class="parameter">join_type</replaceable> <replaceable class="parameter">from_item</replaceable> [ ON <replaceable class="parameter">join_condition</replaceable> | USING ( <replaceable class="parameter">join_column</replaceable> [, ...] ) ]
and <replaceable class="parameter">with_query</replaceable> is: <phrase>and <replaceable class="parameter">with_query</replaceable> is:</phrase>
<replaceable class="parameter">with_query_name</replaceable> [ ( <replaceable class="parameter">column_name</replaceable> [, ...] ) ] AS ( <replaceable class="parameter">select</replaceable> ) <replaceable class="parameter">with_query_name</replaceable> [ ( <replaceable class="parameter">column_name</replaceable> [, ...] ) ] AS ( <replaceable class="parameter">select</replaceable> )
......
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/set_transaction.sgml,v 1.26 2008/11/14 10:22:47 petere Exp $ --> <!-- $PostgreSQL: pgsql/doc/src/sgml/ref/set_transaction.sgml,v 1.27 2009/09/18 05:00:42 petere Exp $ -->
<refentry id="SQL-SET-TRANSACTION"> <refentry id="SQL-SET-TRANSACTION">
<refmeta> <refmeta>
<refentrytitle id="SQL-SET-TRANSACTION-TITLE">SET TRANSACTION</refentrytitle> <refentrytitle id="SQL-SET-TRANSACTION-TITLE">SET TRANSACTION</refentrytitle>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
SET TRANSACTION <replaceable class="parameter">transaction_mode</replaceable> [, ...] SET TRANSACTION <replaceable class="parameter">transaction_mode</replaceable> [, ...]
SET SESSION CHARACTERISTICS AS TRANSACTION <replaceable class="parameter">transaction_mode</replaceable> [, ...] SET SESSION CHARACTERISTICS AS TRANSACTION <replaceable class="parameter">transaction_mode</replaceable> [, ...]
where <replaceable class="parameter">transaction_mode</replaceable> is one of: <phrase>where <replaceable class="parameter">transaction_mode</replaceable> is one of:</phrase>
ISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED } ISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED }
READ WRITE | READ ONLY READ WRITE | READ ONLY
......
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/start_transaction.sgml,v 1.17 2008/11/14 10:22:47 petere Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/start_transaction.sgml,v 1.18 2009/09/18 05:00:42 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -23,7 +23,7 @@ PostgreSQL documentation ...@@ -23,7 +23,7 @@ PostgreSQL documentation
<synopsis> <synopsis>
START TRANSACTION [ <replaceable class="parameter">transaction_mode</replaceable> [, ...] ] START TRANSACTION [ <replaceable class="parameter">transaction_mode</replaceable> [, ...] ]
where <replaceable class="parameter">transaction_mode</replaceable> is one of: <phrase>where <replaceable class="parameter">transaction_mode</replaceable> is one of:</phrase>
ISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED } ISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED }
READ WRITE | READ ONLY READ WRITE | READ ONLY
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group # Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California # Portions Copyright (c) 1994, Regents of the University of California
# #
# $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.65 2009/08/28 20:26:19 petere Exp $ # $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.66 2009/09/18 05:00:42 petere Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -22,6 +22,7 @@ override CPPFLAGS := -I. -I$(srcdir) -I$(libpq_srcdir) -I$(top_srcdir)/src/bin/p ...@@ -22,6 +22,7 @@ override CPPFLAGS := -I. -I$(srcdir) -I$(libpq_srcdir) -I$(top_srcdir)/src/bin/p
OBJS= command.o common.o help.o input.o stringutils.o mainloop.o copy.o \ OBJS= command.o common.o help.o input.o stringutils.o mainloop.o copy.o \
startup.o prompt.o variables.o large_obj.o print.o describe.o \ startup.o prompt.o variables.o large_obj.o print.o describe.o \
psqlscan.o tab-complete.o mbprint.o dumputils.o keywords.o kwlookup.o \ psqlscan.o tab-complete.o mbprint.o dumputils.o keywords.o kwlookup.o \
sql_help.o \
$(WIN32RES) $(WIN32RES)
FLEXFLAGS = -Cfe FLEXFLAGS = -Cfe
...@@ -40,8 +41,9 @@ dumputils.c keywords.c: % : $(top_srcdir)/src/bin/pg_dump/% ...@@ -40,8 +41,9 @@ dumputils.c keywords.c: % : $(top_srcdir)/src/bin/pg_dump/%
kwlookup.c: % : $(top_srcdir)/src/backend/parser/% kwlookup.c: % : $(top_srcdir)/src/backend/parser/%
rm -f $@ && $(LN_S) $< . rm -f $@ && $(LN_S) $< .
sql_help.c: sql_help.h ;
sql_help.h: create_help.pl $(wildcard $(REFDOCDIR)/*.sgml) sql_help.h: create_help.pl $(wildcard $(REFDOCDIR)/*.sgml)
$(PERL) $< $(REFDOCDIR) $@ $(PERL) $< $(REFDOCDIR) $*
psqlscan.c: psqlscan.l psqlscan.c: psqlscan.l
ifdef FLEX ifdef FLEX
...@@ -67,4 +69,4 @@ clean distclean: ...@@ -67,4 +69,4 @@ clean distclean:
rm -f psql$(X) $(OBJS) dumputils.c keywords.c kwlookup.c rm -f psql$(X) $(OBJS) dumputils.c keywords.c kwlookup.c
maintainer-clean: distclean maintainer-clean: distclean
rm -f sql_help.h psqlscan.c rm -f sql_help.h sql_help.c psqlscan.c
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# #
# Copyright (c) 2000-2009, PostgreSQL Global Development Group # Copyright (c) 2000-2009, PostgreSQL Global Development Group
# #
# $PostgreSQL: pgsql/src/bin/psql/create_help.pl,v 1.19 2009/01/01 17:23:54 momjian Exp $ # $PostgreSQL: pgsql/src/bin/psql/create_help.pl,v 1.20 2009/09/18 05:00:42 petere Exp $
################################################################# #################################################################
# #
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
# enough that this worked, but this here is by no means an SGML # enough that this worked, but this here is by no means an SGML
# parser. # parser.
# #
# Call: perl create_help.pl docdir sql_help.h # Call: perl create_help.pl docdir sql_help
# The name of the header file doesn't matter to this script, but it # The name of the header file doesn't matter to this script, but it
# sure does matter to the rest of the source. # sure does matter to the rest of the source.
# #
...@@ -22,26 +22,29 @@ ...@@ -22,26 +22,29 @@
use strict; use strict;
my $docdir = $ARGV[0] or die "$0: missing required argument: docdir\n"; my $docdir = $ARGV[0] or die "$0: missing required argument: docdir\n";
my $outputfile = $ARGV[1] or die "$0: missing required argument: output file\n"; my $hfile = $ARGV[1] . '.h' or die "$0: missing required argument: output file\n";
my $cfile = $ARGV[1] . '.c';
my $outputfilebasename; my $hfilebasename;
if ($outputfile =~ m!.*/([^/]+)$!) { if ($hfile =~ m!.*/([^/]+)$!) {
$outputfilebasename = $1; $hfilebasename = $1;
} }
else { else {
$outputfilebasename = $outputfile; $hfilebasename = $hfile;
} }
my $define = $outputfilebasename; my $define = $hfilebasename;
$define =~ tr/a-z/A-Z/; $define =~ tr/a-z/A-Z/;
$define =~ s/\W/_/g; $define =~ s/\W/_/g;
opendir(DIR, $docdir) opendir(DIR, $docdir)
or die "$0: could not open documentation source dir '$docdir': $!\n"; or die "$0: could not open documentation source dir '$docdir': $!\n";
open(OUT, ">$outputfile") open(HFILE, ">$hfile")
or die "$0: could not open output file '$outputfile': $!\n"; or die "$0: could not open output file '$hfile': $!\n";
open(CFILE, ">$cfile")
or die "$0: could not open output file '$cfile': $!\n";
print OUT print HFILE
"/* "/*
* *** Do not change this file by hand. It is automatically * *** Do not change this file by hand. It is automatically
* *** generated from the DocBook documentation. * *** generated from the DocBook documentation.
...@@ -56,15 +59,31 @@ print OUT ...@@ -56,15 +59,31 @@ print OUT
#define N_(x) (x) /* gettext noop */ #define N_(x) (x) /* gettext noop */
#include \"postgres_fe.h\"
#include \"pqexpbuffer.h\"
struct _helpStruct struct _helpStruct
{ {
const char *cmd; /* the command name */ const char *cmd; /* the command name */
const char *help; /* the help associated with it */ const char *help; /* the help associated with it */
const char *syntax; /* the syntax associated with it */ void (*syntaxfunc)(PQExpBuffer); /* function that prints the syntax associated with it */
int nl_count; /* number of newlines in syntax (for pager) */
}; };
";
print CFILE
"/*
* *** Do not change this file by hand. It is automatically
* *** generated from the DocBook documentation.
*
* generated by
* $^X $0 @ARGV
*
*/
#include \"$hfile\"
static const struct _helpStruct QL_HELP[] = {
"; ";
my $maxlen = 0; my $maxlen = 0;
...@@ -95,12 +114,25 @@ foreach my $file (sort readdir DIR) { ...@@ -95,12 +114,25 @@ foreach my $file (sort readdir DIR) {
$cmddesc =~ s/\s+/ /g; $cmddesc =~ s/\s+/ /g;
$cmddesc =~ s/\"/\\"/g; $cmddesc =~ s/\"/\\"/g;
$cmdsynopsis =~ s/<[^>]+>//g; my @params = ();
my $nl_count = () = $cmdsynopsis =~ /\n/g;
$cmdsynopsis =~ m!</>! and die "$0:$file: null end tag not supported in synopsis\n";
$cmdsynopsis =~ s/%/%%/g;
while ($cmdsynopsis =~ m!<(\w+)[^>]*>(.+?)</\1[^>]*>!) {
my $match = $2;
$match =~ s/<[^>]+>//g;
$match =~ s/%%/%/g;
push @params, $match;
$cmdsynopsis =~ s!<(\w+)[^>]*>.+?</\1[^>]*>!%s!;
}
$cmdsynopsis =~ s/\r?\n/\\n/g; $cmdsynopsis =~ s/\r?\n/\\n/g;
$cmdsynopsis =~ s/\"/\\"/g; $cmdsynopsis =~ s/\"/\\"/g;
foreach my $cmdname (@cmdnames) { foreach my $cmdname (@cmdnames) {
$entries{$cmdname} = { cmddesc => $cmddesc, cmdsynopsis => $cmdsynopsis }; $entries{$cmdname} = { cmddesc => $cmddesc, cmdsynopsis => $cmdsynopsis, params => \@params, nl_count => $nl_count };
$maxlen = ($maxlen >= length $cmdname) ? $maxlen : length $cmdname; $maxlen = ($maxlen >= length $cmdname) ? $maxlen : length $cmdname;
} }
} }
...@@ -109,9 +141,41 @@ foreach my $file (sort readdir DIR) { ...@@ -109,9 +141,41 @@ foreach my $file (sort readdir DIR) {
} }
} }
print OUT " { \"$_\",\n N_(\"".$entries{$_}{cmddesc}."\"),\n N_(\"".$entries{$_}{cmdsynopsis}."\") },\n\n" foreach (sort keys %entries); foreach (sort keys %entries) {
my $prefix = "\t"x5 . ' ';
my $id = $_;
$id =~ s/ /_/g;
my $synopsis = "\"$entries{$_}{cmdsynopsis}\"";
$synopsis =~ s/\\n/\\n"\n$prefix"/g;
my @args = ("buf",
$synopsis,
map("_(\"$_\")", @{$entries{$_}{params}}));
print HFILE "extern void sql_help_$id(PQExpBuffer buf);\n";
print CFILE "void
sql_help_$id(PQExpBuffer buf)
{
\tappendPQExpBuffer(".join(",\n$prefix", @args).");
}
";
}
print HFILE "
static const struct _helpStruct QL_HELP[] = {
";
foreach (sort keys %entries) {
my $id = $_;
$id =~ s/ /_/g;
print HFILE " { \"$_\",
N_(\"$entries{$_}{cmddesc}\"),
sql_help_$id,
$entries{$_}{nl_count} },
";
}
print OUT " print HFILE "
{ NULL, NULL, NULL } /* End of list marker */ { NULL, NULL, NULL } /* End of list marker */
}; };
...@@ -123,5 +187,6 @@ print OUT " ...@@ -123,5 +187,6 @@ print OUT "
#endif /* $define */ #endif /* $define */
"; ";
close OUT; close CFILE;
close HFILE;
closedir DIR; closedir DIR;
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (c) 2000-2009, PostgreSQL Global Development Group * Copyright (c) 2000-2009, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.151 2009/07/24 19:35:44 petere Exp $ * $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.152 2009/09/18 05:00:42 petere Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
...@@ -349,7 +349,6 @@ helpSQL(const char *topic, unsigned short int pager) ...@@ -349,7 +349,6 @@ helpSQL(const char *topic, unsigned short int pager)
size_t len, size_t len,
wordlen; wordlen;
int nl_count = 0; int nl_count = 0;
const char *ch;
/* User gets two chances: exact match, then the first word */ /* User gets two chances: exact match, then the first word */
...@@ -386,10 +385,8 @@ helpSQL(const char *topic, unsigned short int pager) ...@@ -386,10 +385,8 @@ helpSQL(const char *topic, unsigned short int pager)
if (pg_strncasecmp(topic, QL_HELP[i].cmd, len) == 0 || if (pg_strncasecmp(topic, QL_HELP[i].cmd, len) == 0 ||
strcmp(topic, "*") == 0) strcmp(topic, "*") == 0)
{ {
nl_count += 5; nl_count += 5 + QL_HELP[i].nl_count;
for (ch = QL_HELP[i].syntax; *ch != '\0'; ch++)
if (*ch == '\n')
nl_count++;
/* If we have an exact match, exit. Fixes \h SELECT */ /* If we have an exact match, exit. Fixes \h SELECT */
if (pg_strcasecmp(topic, QL_HELP[i].cmd) == 0) if (pg_strcasecmp(topic, QL_HELP[i].cmd) == 0)
break; break;
...@@ -403,13 +400,17 @@ helpSQL(const char *topic, unsigned short int pager) ...@@ -403,13 +400,17 @@ helpSQL(const char *topic, unsigned short int pager)
if (pg_strncasecmp(topic, QL_HELP[i].cmd, len) == 0 || if (pg_strncasecmp(topic, QL_HELP[i].cmd, len) == 0 ||
strcmp(topic, "*") == 0) strcmp(topic, "*") == 0)
{ {
PQExpBufferData buffer;
initPQExpBuffer(&buffer);
QL_HELP[i].syntaxfunc(&buffer);
help_found = true; help_found = true;
fprintf(output, _("Command: %s\n" fprintf(output, _("Command: %s\n"
"Description: %s\n" "Description: %s\n"
"Syntax:\n%s\n\n"), "Syntax:\n%s\n\n"),
QL_HELP[i].cmd, QL_HELP[i].cmd,
_(QL_HELP[i].help), _(QL_HELP[i].help),
_(QL_HELP[i].syntax)); buffer.data);
/* If we have an exact match, exit. Fixes \h SELECT */ /* If we have an exact match, exit. Fixes \h SELECT */
if (pg_strcasecmp(topic, QL_HELP[i].cmd) == 0) if (pg_strcasecmp(topic, QL_HELP[i].cmd) == 0)
break; break;
......
# $PostgreSQL: pgsql/src/bin/psql/nls.mk,v 1.23 2009/06/26 19:33:50 petere Exp $ # $PostgreSQL: pgsql/src/bin/psql/nls.mk,v 1.24 2009/09/18 05:00:42 petere Exp $
CATALOG_NAME := psql CATALOG_NAME := psql
AVAIL_LANGUAGES := cs de es fr ja pt_BR sv tr AVAIL_LANGUAGES := cs de es fr ja pt_BR sv tr
GETTEXT_FILES := command.c common.c copy.c help.c input.c large_obj.c \ GETTEXT_FILES := command.c common.c copy.c help.c input.c large_obj.c \
mainloop.c print.c startup.c describe.c sql_help.h \ mainloop.c print.c startup.c describe.c sql_help.h sql_help.c \
../../port/exec.c ../../port/exec.c
GETTEXT_TRIGGERS:= _ N_ psql_error simple_prompt GETTEXT_TRIGGERS:= _ N_ psql_error simple_prompt
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment