导出oids系统列

最近更新时间: 2025-02-18 16:02:00

  • 复制
    复制成功
postgres=# drop table t;
DROP TABLE
postgres=# CREATE TABLE t (
postgres(#     f1 integer NOT NULL,
postgres(#     f2 text NOT NULL,
postgres(#     f3 timestamp without time zone,
postgres(#     f4 integer
postgres(# )
postgres-# with oids DISTRIBUTE BY SHARD (f1);
CREATE TABLE
postgres=# copy t from '/data/pgxz/t.txt' with csv ;         
COPY 3
postgres=# select * from t;
 f1 |      f2       |             f3             | f4 
----+---------------+----------------------------+----
  1 | TDSQL PG         |                            |  7
  2 | pg'",      xc | 2017-10-28 18:24:05.643102 |  3
  3 | pgxz          | 2017-10-28 18:24:05.645691 |   
(3 rows)
postgres=# copy t to  '/data/pgxz/t.txt' with oids ;              
COPY 3
postgres=# \! cat /data/pgxz/t.txt
35055   1       TDSQL PG   \N      7
35056   2       pg'",      xc   2017-10-28 18:24:05.643102      3
35177   3       pgxz    2017-10-28 18:24:05.645691      \N

创建表时使用了with oids才能使用oids 选项。