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

[YSQL] pg_partman: fix logic of checking existing table in create_partition_time #23322

Closed
yugabyte-ci opened this issue Jul 30, 2024 · 0 comments
Assignees
Labels
jira-originated kind/bug This issue is a bug priority/high High Priority

Comments

@yugabyte-ci
Copy link
Contributor

yugabyte-ci commented Jul 30, 2024

Jira Link: DB-12247

@yugabyte-ci yugabyte-ci added jira-originated kind/bug This issue is a bug priority/high High Priority labels Jul 30, 2024
devansh-ism pushed a commit that referenced this issue Aug 1, 2024
Summary:
Diff D36428 added an incorrect assertion in create_partition_time to check if a child table is already created .

```
    IF v_exists IS NULL THEN
        RAISE DEBUG 'create_partition_time v_sql: %', v_sql;
        EXECUTE v_sql;
    END IF;
```

`v_exists` is of type `smallint` and should be check if it is greater than zero or not. This diff fixes this bug.
Jira: DB-12247

Test Plan:
jenkins: compile only

Manual Test:

```
yugabyte=# CREATE SCHEMA IF NOT EXISTS partman;
CREATE SCHEMA
yugabyte=# CREATE EXTENSION pg_partman WITH SCHEMA partman;
CREATE EXTENSION
yugabyte=# CREATE SCHEMA partman_test;
CREATE SCHEMA
yugabyte=# CREATE TABLE partman_test.time_taptest_table (
yugabyte(#     col1 int,
yugabyte(#     col2 text,
yugabyte(#     col3 int NOT NULL DEFAULT extract('epoch' from CURRENT_TIMESTAMP)::int)
yugabyte-# PARTITION BY RANGE (col3);
CREATE TABLE
yugabyte=# \d partman_test.time_taptest_table
                             Table "partman_test.time_taptest_table"
 Column |  Type   | Collation | Nullable |                        Default
--------+---------+-----------+----------+--------------------------------------------------------
 col1   | integer |           |          |
 col2   | text    |           |          |
 col3   | integer |           | not null | (date_part('epoch'::text, CURRENT_TIMESTAMP))::integer
Partition key: RANGE (col3)
Number of partitions: 0

yugabyte=# SELECT partman.create_parent('partman_test.time_taptest_table', 'col3', 'native', 'weekly', '{"col1"}', p_epoch := 'seconds'
yugabyte(#     , p_premake := 2, p_start_partition := to_char(CURRENT_TIMESTAMP-'8 weeks'::interval, 'YYYY-MM-DD HH24:MI:SS'));
 create_parent
---------------
 t
(1 row)

yugabyte=# \d+ partman_test.time_taptest_table
                                                 Table "partman_test.time_taptest_table"
 Column |  Type   | Collation | Nullable |                        Default                         | Storage  | Stats target | Description
--------+---------+-----------+----------+--------------------------------------------------------+----------+--------------+-------------
 col1   | integer |           |          |                                                        | plain    |              |
 col2   | text    |           |          |                                                        | extended |              |
 col3   | integer |           | not null | (date_part('epoch'::text, CURRENT_TIMESTAMP))::integer | plain    |              |
Partition key: RANGE (col3)
Partitions: partman_test.time_taptest_table_p2024w23 FOR VALUES FROM (1717353000) TO (1717957800),
            partman_test.time_taptest_table_p2024w24 FOR VALUES FROM (1717957800) TO (1718562600),
            partman_test.time_taptest_table_p2024w25 FOR VALUES FROM (1718562600) TO (1719167400),
            partman_test.time_taptest_table_p2024w26 FOR VALUES FROM (1719167400) TO (1719772200),
            partman_test.time_taptest_table_p2024w27 FOR VALUES FROM (1719772200) TO (1720377000),
            partman_test.time_taptest_table_p2024w28 FOR VALUES FROM (1720377000) TO (1720981800),
            partman_test.time_taptest_table_p2024w29 FOR VALUES FROM (1720981800) TO (1721586600),
            partman_test.time_taptest_table_p2024w30 FOR VALUES FROM (1721586600) TO (1722191400),
            partman_test.time_taptest_table_p2024w31 FOR VALUES FROM (1722191400) TO (1722796200),
            partman_test.time_taptest_table_p2024w32 FOR VALUES FROM (1722796200) TO (1723401000),
            partman_test.time_taptest_table_p2024w33 FOR VALUES FROM (1723401000) TO (1724005800),
            partman_test.time_taptest_table_default DEFAULT
```

Reviewers: jason, hsunder

Reviewed By: hsunder

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D36916
jasonyb pushed a commit that referenced this issue Aug 2, 2024
Summary:
 66890cb [PLAT-14781] Add runtime config for download metrics as pdf
 b2f24f2 [#9797] YSQL: Stubs for ysql major version upgrade RPCs
 5891faa [#23332] Docdb: Fix yb-admin to handle snapshot_retention correctly
 0614c52 [PLAT-14756] Releases API RBAC cleanup
 2cfb999 [docs] Release notes for 2024.1.1.0-b137 (#23185)
 d868a03 [PLAT-13495] Do not run dual nic steps on systemd upgrade
 10bc447 [PLAT-14798] Adding internal load balancer to devspace
 7296df8 [docs] [2.23] Add pg_cron extension docs (#22546)
 79902ae [PLAT-14678] - feat : Export All Metrics to pdf
 8a0b95c [#23322] YSQL: pg_partman: fix logic of checking existing table
 Excluded: 63f471a [#18822] YSQL: Framework to skip redundant sec index updates and fkey checks when relevant columns not modified
 3040472 [PLAT-14783] [PGParity] After Edit RR cores scale up on PG Parity enabled cluster, the RR node does not have PGP gflags
 e052089 [PLAT-14774] Per process tserver metrics is not working if YSQL is disabled
 0c664a1 [#22370] docdb: Cost Based Optimizer changes to take into account backward scans improvement
 a060877 [PLAT-13712]fix plan info for Azure VMs
 291dd40 Remove 6sense domains from CSP headers (#23354)
 75cb273 [#23330] docdb: fixed static columns handling for CQL operations

Test Plan: Jenkins: rebase: pg15-cherrypicks

Reviewers: jason, tfoucher

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D36984
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira-originated kind/bug This issue is a bug priority/high High Priority
Projects
None yet
Development

No branches or pull requests

2 participants