Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Как задать партиционирование если таблица еще пустая? #275

Open
Guzya opened this issue Jun 10, 2024 · 0 comments

Comments

@Guzya
Copy link

Guzya commented Jun 10, 2024

Problem description

Имеются таблицы, еще пустые. На них надо задать партиционирование до заливки данных.
Но не понятно как.

Воспользовался примером в одной из задач, но ни чего не вышло.

Environment

=# create table test_1(modification_time timestamp not null);
CREATE TABLE
=# SELECT create_range_partitions('test_1', 'modification_time', null::date, '1 day'::interval,0);
 create_range_partitions 
-------------------------
                       0
(1 row)

=# insert into test_1 values (now());
INSERT 0 1
=# insert into test_1 values (now()+'1 day'::interval);
INSERT 0 1

=# \d+ test_1
                                                  Table "public.test_1"
      Column       |            Type             | Collation | Nullable | Default | Storage | Stats target | Description 
-------------------+-----------------------------+-----------+----------+---------+---------+--------------+-------------
 modification_time | timestamp without time zone |           | not null |         | plain   |              | 

=# \d test_1
                              Table "public.test_1"
      Column       |            Type             | Collation | Nullable | Default 
-------------------+-----------------------------+-----------+----------+---------
 modification_time | timestamp without time zone |           | not null | 


=# drop table test_1 ;
ERROR:  cannot drop table test_1 because other objects depend on it
DETAIL:  sequence test_1_seq depends on table test_1
HINT:  Use DROP ... CASCADE to drop the dependent objects too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant