CREATE TABLE distributors (
- did integer CHECK (did > 100),
+ did integer CHECK (did > 100),
name varchar(40)
);
CREATE TABLE distributors (
did integer,
name varchar(40)
- CONSTRAINT con1 CHECK (did > 100 AND name <> '')
+ CONSTRAINT con1 CHECK (did > 100 AND name <> '')
);
Use 's \z command
to obtain information about existing privileges, for example:
-=> \z mytable
+=> \z mytable
Access privileges for database "lusitania"
Schema | Name | Type | Access privileges
BEGIN WORK;
LOCK TABLE films IN SHARE ROW EXCLUSIVE MODE;
DELETE FROM films_user_comments WHERE id IN
- (SELECT id FROM films WHERE rating < 5);
-DELETE FROM films WHERE rating < 5;
+ (SELECT id FROM films WHERE rating < 5);
+DELETE FROM films WHERE rating < 5;
COMMIT WORK;
they don't cause a syntax error when the second line is processed. This
could be done with the program sed:
-testdb=> \set content '\'' `sed -e "s/'/\\\\\\'/g" < my_file.txt` '\''
+testdb=> \set content '\'' `sed -e "s/'/\\\\\\'/g" < my_file.txt` '\''
Observe the correct number of backslashes (6)! It works
this way: After
psql has parsed this
- line, it passes sed -e "s/'/\\\'/g" < my_file.txt
+ line, it passes sed -e "s/'/\\\'/g" < my_file.txt
to the shell. The shell will do its own thing inside the double
quotes and execute sed with the arguments
-e and s/'/\\'/g. When
The full host name (with domain name) of the database server,
or [local] if the connection is over a Unix
domain socket, or
-
[local:/dir/name]
- >, if the Unix domain socket is not at the compiled in default
+ [local:/dir/name]>,
+ if the Unix domain socket is not at the compiled in default
location.
input. Notice the changing prompt:
testdb=> CREATE TABLE my_table (
-testdb(> first integer not null default 0,
-testdb(> second text)
+testdb(> first integer not null default 0,
+testdb(> second text)
testdb-> ;
CREATE TABLE
$ export PGOPTIONS="-P"
$ psql broken_db
...
-broken_db=> REINDEX DATABASE broken_db;
-broken_db=> \q
+broken_db=> REINDEX DATABASE broken_db;
+broken_db=> \q
SELECT kind, sum(len) AS total
FROM films
GROUP BY kind
- HAVING sum(len) < interval '5 hours';
+ HAVING sum(len) < interval '5 hours';
kind | total
----------+-------