mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-03-01 19:45:33 +08:00
Tablespace examples for CREATE TABLE/INDEX/SCHEMA/DATABASE as well as
some other examples for CREATE DATABASE. Gavin Sherry
This commit is contained in:
parent
3095c104f0
commit
7bcdf2ebee
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_database.sgml,v 1.39 2004/06/18 06:13:05 tgl Exp $
|
$PostgreSQL: pgsql/doc/src/sgml/ref/create_database.sgml,v 1.40 2004/07/12 01:22:53 momjian Exp $
|
||||||
PostgreSQL documentation
|
PostgreSQL documentation
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@ -169,6 +169,26 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
|
|||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
CREATE DATABASE lusiadas;
|
CREATE DATABASE lusiadas;
|
||||||
|
</programlisting>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
To create a database <literal>sales</> owned by user <literal>salesapp</>>
|
||||||
|
with a default tablespace of <literal>salesspace</>:
|
||||||
|
|
||||||
|
<programlisting>
|
||||||
|
CREATE DATABASE sales OWNER salesapp TABLESPACE salesspace;
|
||||||
|
</programlisting>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
To create a database <literal>music</> which supports the ISO-8859-1
|
||||||
|
character set:
|
||||||
|
|
||||||
|
<programlisting>
|
||||||
|
CREATE DATABASE music ENCODING 'LATIN1';
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_index.sgml,v 1.48 2004/06/18 06:13:05 tgl Exp $
|
$PostgreSQL: pgsql/doc/src/sgml/ref/create_index.sgml,v 1.49 2004/07/12 01:22:53 momjian Exp $
|
||||||
PostgreSQL documentation
|
PostgreSQL documentation
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@ -251,6 +251,15 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">name</replaceable> ON <re
|
|||||||
the table <literal>films</literal>:
|
the table <literal>films</literal>:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
CREATE UNIQUE INDEX title_idx ON films (title);
|
CREATE UNIQUE INDEX title_idx ON films (title);
|
||||||
|
</programlisting>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
To create an index on the column <literal>code</> in the table
|
||||||
|
<literal>films</> and have the index reside in the tablespace
|
||||||
|
<literal>indexspace</>:
|
||||||
|
<programlisting>
|
||||||
|
CREATE INDEX code_idx ON films(code) TABLESPACE indexspace;
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_schema.sgml,v 1.13 2004/06/25 21:55:50 tgl Exp $
|
$PostgreSQL: pgsql/doc/src/sgml/ref/create_schema.sgml,v 1.14 2004/07/12 01:22:53 momjian Exp $
|
||||||
PostgreSQL documentation
|
PostgreSQL documentation
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@ -160,6 +160,16 @@ CREATE VIEW hollywood.winners AS
|
|||||||
SELECT title, release FROM hollywood.films WHERE awards IS NOT NULL;
|
SELECT title, release FROM hollywood.films WHERE awards IS NOT NULL;
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Create a schema <literal>sales</> whose tables, indexes and sequences
|
||||||
|
will be stored in the tablespace <literal>mirrorspace</> by default:
|
||||||
|
|
||||||
|
<programlisting>
|
||||||
|
CREATE SCHEMA sales TABLESPACE mirrorspace;
|
||||||
|
</programlisting>
|
||||||
|
</para>
|
||||||
|
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_table.sgml,v 1.82 2004/06/18 06:13:05 tgl Exp $
|
$PostgreSQL: pgsql/doc/src/sgml/ref/create_table.sgml,v 1.83 2004/07/12 01:22:53 momjian Exp $
|
||||||
PostgreSQL documentation
|
PostgreSQL documentation
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@ -821,6 +821,18 @@ CREATE TABLE distributors (
|
|||||||
name varchar(40),
|
name varchar(40),
|
||||||
UNIQUE(name)
|
UNIQUE(name)
|
||||||
);
|
);
|
||||||
|
</programlisting>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Create table <structname>cinemas</> in tablespace <structname>diskvol1</>:
|
||||||
|
|
||||||
|
<programlisting>
|
||||||
|
CREATE TABLE cinemas (
|
||||||
|
id serial,
|
||||||
|
name text,
|
||||||
|
location text
|
||||||
|
) TABLESPACE diskvol1;
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user