Copy tables.
--- a/postgres.rst Fri Apr 16 00:11:21 2021 +0300
+++ b/postgres.rst Thu Apr 22 10:57:04 2021 +0300
@@ -596,6 +596,26 @@
$ psql -U $USER -h $HOST $DB -c "\\copy tbl_name from 'my.csv' csv"
+Copy tables
+===========
+
+Create table *with* data copying using another table (no constraints & indices are recreated,
+including PK)::
+
+ CREATE TABLE mycopy AS TABLE myorig;
+
+Create table *without* data copying using another table::
+
+ CREATE TABLE mycopy AS TABLE myorig WITH NO DATA;
+
+Create table from select and copy data (no constraints & indices are recreated, including PK)::
+
+ CREATE TABLE mycopy AS (SELECT * FROM myorig);
+
+Create table from select (without copying data)::
+
+ CREATE TABLE mycopy AS (SELECT * FROM myorig) WITH NO DATA;
+
JDBC driver
===========