Newer
Older
Thomas G. Lockhart
committed
In the current release of <productname>Postgres</productname> (v6.4), to create a temporary
table you must create and drop the table by explicit commands.
Thomas G. Lockhart
committed
</tip>
<REFSECT3 ID="R3-SQL-UNIQUECLAUSE-1">
<REFSECT3INFO>
<DATE>1998-04-15</DATE>
</REFSECT3INFO>
<TITLE>
UNIQUE clause
</TITLE>
<PARA>
SQL92 specifies some additional capabilities for UNIQUE:
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
Table Constraint definition
</PARA>
<synopsis>
[ CONSTRAINT name ]
UNIQUE ( column [, ...] )
[ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ]
[ [ NOT ] DEFERRABLE ]
</synopsis>
<para>
Column Constraint definition
</para>
<synopsis>
[ CONSTRAINT name ]
UNIQUE
[ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ]
[ [ NOT ] DEFERRABLE ]
</synopsis>
</refsect3>
<REFSECT3 ID="R3-SQL-NOTNULL-4">
<REFSECT3INFO>
<DATE>1998-04-15</DATE>
</REFSECT3INFO>
<TITLE>
NOT NULL clause
</TITLE>
<PARA>
SQL92 specifies some additional capabilities for NOT NULL:
</PARA>
<synopsis>
[ CONSTRAINT name ] NOT NULL
[ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ]
[ [ NOT ] DEFERRABLE ]
</synopsis>
</REFSECT3>
Thomas G. Lockhart
committed
<!--
I can't figure out why DEFAULT clause is different from what we already have.
Perhaps because CURRENT_USER and CURRENT_DATE have specific types (currently
the "name" type), if you aren't careful then the types won't match up with
the column. Not our problem...
- Thomas 1998-08-16
<REFSECT3 ID="R3-SQL-DEFAULTCLAUSE-1">
<REFSECT3INFO>
<DATE>1998-04-15</DATE>
</REFSECT3INFO>
<TITLE>
DEFAULT clause
</TITLE>
<PARA>
SQL92 specifies some additional capabilities for the DEFAULT clause.
A DEFAULT clause is used to set the default value for a column
or a domain.
</para>
<synopsis>
Thomas G. Lockhart
committed
DEFAULT niladic USER function |
niladic datetime function |
NULL
</synopsis>
</refsect3>
Thomas G. Lockhart
committed
-->
<REFSECT3 ID="R3-SQL-CONSTRAINT-3">
<REFSECT3INFO>
<DATE>1998-04-15</DATE>
</REFSECT3INFO>
<TITLE>
CONSTRAINT clause
</TITLE>
<PARA>
SQL92 specifies some additional capabilities for CONSTRAINTs,
Thomas G. Lockhart
committed
and also defines assertions and domain constraints.
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
</PARA>
<PARA>
An assertion is a special type of integrity constraint and share
the same namespace as other constraints.
However, an assertion is not necessarily dependent on one
particular base table as constraints are, so SQL-92 provides the
CREATE ASSERTION statement as an alternate method for defining a
constraint:
</para>
<synopsis>
CREATE ASSERTION name CHECK ( condition )
</synopsis>
<PARA>
Domain constraints are defined by CREATE DOMAIN or ALTER DOMAIN
statements:
</para>
<PARA>
Domain constraint:
</para>
<synopsis>
[ CONSTRAINT name ]
CHECK constraint
[ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ]
[ [ NOT ] DEFERRABLE ]
</synopsis>
<para>
Table constraint definition:
</para>
<synopsis>
[ CONSTRAINT name ]
{ PRIMARY KEY constraint |
FOREIGN KEY constraint |
UNIQUE constraint |
CHECK constraint }
[ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ]
[ [ NOT ] DEFERRABLE ]</synopsis>
<para>
Column constraint definition:
</para>
<synopsis>
[ CONSTRAINT name ]
{ NOT NULL constraint |
PRIMARY KEY constraint |
FOREIGN KEY constraint |
UNIQUE constraint |
CHECK constraint }
[ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ]
[ [ NOT ] DEFERRABLE ]
</synopsis>
<para>
A CONSTRAINT definition may contain one deferment attribute
clause and/or one initial constraint mode clause, in any order.
<variablelist>
<varlistentry>
<term>NOT DEFERRABLE</term>
<listitem>
<para>
means that the Constraint must be checked for
violation of its rule after the execution of every SQL statement.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>DEFERRABLE</term>
<listitem>
<para>
means that checking of the Constraint may be deferred
until some later time, but no later than the end of the current
transaction.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
The constraint mode for every Constraint always has an initial
default value which is set for that Constraint at the beginning
of a transaction.
<variablelist>
<varlistentry>
<term>INITIALLY IMMEDIATE</term>
<listitem>
<para>
means that, as of the start of the transaction,
the Constraint must be checked for violation of its rule after the
execution of every SQL statement.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>INITIALLY DEFERRED</term>
<listitem>
<para>
means that, as of the start of the transaction,
checking of the Constraint may be deferred until some later time,
but no later than the end of the current transaction.</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect3>
<REFSECT3 ID="R3-SQL-CHECK-4">
<REFSECT3INFO>
<DATE>1998-04-15</DATE>
</REFSECT3INFO>
<TITLE>
CHECK clause
</TITLE>
<PARA>
Thomas G. Lockhart
committed
SQL92 specifies some additional capabilities for CHECK in either
table or column constraints.
Thomas G. Lockhart
committed
<!--
Constraints associated with domains do not need to be mentioned here,
even though it is the case that a domain constraint may possibly
affect a column or a table.
- Thomas 1998-08-16
<para>
A CHECK constraint is either a table constraint, a column
constraint or a domain constraint.
</para>
Thomas G. Lockhart
committed
-->
<para>
table constraint definition:
</para>
<synopsis>
[ CONSTRAINT name ]
CHECK ( VALUE condition )
[ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ]
[ [ NOT ] DEFERRABLE ]
</synopsis>
<para>
column constraint definition:
</para>
<synopsis>
[ CONSTRAINT name ]
CHECK ( VALUE condition )
[ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ]
[ [ NOT ] DEFERRABLE ]
</synopsis>
Thomas G. Lockhart
committed
<!--
<para>
domain constraint definition:
</para>
<synopsis>
[ CONSTRAINT name ]
CHECK ( VALUE condition )
[ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ]
[ [ NOT ] DEFERRABLE ]
</synopsis>
<para>
CHECK domain constraints can be defined in either
a CREATE DOMAIN statement or an ALTER DOMAIN statement:
</para>
<programlisting>
CREATE DOMAIN duration AS SMALLINT
CONSTRAINT minutes CHECK (VALUE IN (90,120,180,240));
ALTER DOMAIN cities
ADD CONSTRAINT new_city CHECK (VALUE LIKE 'L%');
</programlisting>
Thomas G. Lockhart
committed
-->
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
</refsect3>
<REFSECT3 ID="R3-SQL-PRIMARYKEY-1">
<REFSECT3INFO>
<DATE>1998-04-15</DATE>
</REFSECT3INFO>
<TITLE>
PRIMARY KEY clause
</TITLE>
<PARA>
SQL92 specifies some additional capabilities for PRIMARY KEY:
</para>
<PARA>
Table Constraint definition:
</para>
<synopsis>
[ CONSTRAINT name ]
PRIMARY KEY ( column [, ...] )
[ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ]
[ [ NOT ] DEFERRABLE ]
</synopsis>
<para>
Column Constraint definition:
</para>
<synopsis>
[ CONSTRAINT name ]
PRIMARY KEY
[ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ]
[ [ NOT ] DEFERRABLE ]
</synopsis>
</refsect3>
</refsect2>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End: