Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql 更改表格以添加';按范围划分';博士后_Postgresql - Fatal编程技术网

Postgresql 更改表格以添加';按范围划分';博士后

Postgresql 更改表格以添加';按范围划分';博士后,postgresql,Postgresql,我想通过添加分区范围和存档日期来更改表 CREATE TABLE transactions( id UUID not null , txn_id UUID NOT NULL, orderId UUID NOT NULL, inserttstmp timestamp not NULL archivedate timestamp

我想通过添加分区范围存档日期更改

CREATE TABLE transactions(
    id              UUID         not null ,
    txn_id          UUID         NOT NULL,
    orderId         UUID         NOT NULL,
    inserttstmp     timestamp    not NULL
    archivedate     timestamp    NULL
)
通常,每当我用下面的脚本创建带有分区的新表时。但现在,我们希望对现有表执行相同的操作

CREATE TABLE attachment(
    id              UUID            not null,
    txn_id          UUID         NOT NULL,
    attachment_id   UUID         NOT NULL,
    inserttstmp     timestamp    not NULL
    archivedate     timestamp    NULL
)PARTITION BY RANGE (archivedate);

CREATE TABLE ins_txn_attachment_live PARTITION OF ins_txn_attachment DEFAULT;
ALTER  TABLE ins_txn_attachment_live ADD CHECK (archivedate is null);
ALTER  TABLE ins_txn_attachment_live ADD CONSTRAINT PK_INS_TXN_ATTACHMENT_EVENT_Live unique (id);

CREATE UNIQUE NONCLUSTERED INDEX PK_Ins_TXN_Attachment_ID_ArchiveData ON ins_txn_attachment (id,archivedate);
谢谢,
Jagadeesh

您能添加
postgres
版本吗?请检查