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

[YCQL] fill definition of a shell type requires catalog version increment #24217

Closed
1 task done
myang2021 opened this issue Oct 1, 2024 · 0 comments
Closed
1 task done
Assignees
Labels
area/ycql Yugabyte CQL (YCQL) kind/bug This issue is a bug priority/medium Medium priority issue

Comments

@myang2021
Copy link
Contributor

myang2021 commented Oct 1, 2024

Jira Link: DB-13103

Description

Steps to repro:

  1. In one ysqlsh session:
yugabyte=# CREATE TYPE base_type; -- create shell type
CREATE TYPE
yugabyte=# CREATE FUNCTION base_type_in(cstring) RETURNS base_type
yugabyte-#    LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE AS 'int2in';
NOTICE:  return type base_type is only a shell
CREATE FUNCTION
yugabyte=# CREATE FUNCTION base_type_out(base_type) RETURNS cstring
yugabyte-#    LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE AS 'int2out';
NOTICE:  argument type base_type is only a shell
CREATE FUNCTION
yugabyte=# CREATE FUNCTION base_type_recv(internal) RETURNS base_type
yugabyte-#    LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE AS 'int2recv';
NOTICE:  return type base_type is only a shell
CREATE FUNCTION
yugabyte=# CREATE FUNCTION base_type_send(base_type) RETURNS bytea
yugabyte-#    LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE AS 'int2send';
NOTICE:  argument type base_type is only a shell
CREATE FUNCTION

  1. In a second session:
yugabyte=# CREATE TABLE default_test (f1 base_type, f2 int);
ERROR:  type "base_type" is only a shell
LINE 1: CREATE TABLE default_test (f1 base_type, f2 int);

This ERROR is expected.

  1. Back to the first session to fill the definition of the shell type
yugabyte=# CREATE TYPE base_type (
yugabyte(#    INPUT = base_type_in,
yugabyte(#    OUTPUT = base_type_out,
yugabyte(#    RECEIVE = base_type_recv,
yugabyte(#    SEND = base_type_send,
yugabyte(#    LIKE = smallint,
yugabyte(#    CATEGORY = 'N',
yugabyte(#    PREFERRED = FALSE,
yugabyte(#    DELIMITER = ',',
yugabyte(#    COLLATABLE = FALSE
yugabyte(# ); -- fill definition
CREATE TYPE
  1. Back to the second session
yugabyte=# CREATE TABLE default_test (f1 base_type, f2 int);
ERROR:  type "base_type" is only a shell
LINE 1: CREATE TABLE default_test (f1 base_type, f2 int);

This ERROR is not expected because the first session has already filled the definition of the shell type.

Issue Type

kind/bug

Warning: Please confirm that this issue does not contain any sensitive information

  • I confirm this issue does not contain any sensitive information.
@myang2021 myang2021 added the area/ycql Yugabyte CQL (YCQL) label Oct 1, 2024
@myang2021 myang2021 self-assigned this Oct 1, 2024
@yugabyte-ci yugabyte-ci added kind/bug This issue is a bug priority/medium Medium priority issue labels Oct 1, 2024
myang2021 added a commit that referenced this issue Oct 1, 2024
…on increment

Summary:
Steps to repro:

1. In one ysqlsh session:
```
yugabyte=# CREATE TYPE base_type; -- create shell type
CREATE TYPE
yugabyte=# CREATE FUNCTION base_type_in(cstring) RETURNS base_type
yugabyte-#    LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE AS 'int2in';
NOTICE:  return type base_type is only a shell
CREATE FUNCTION
yugabyte=# CREATE FUNCTION base_type_out(base_type) RETURNS cstring
yugabyte-#    LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE AS 'int2out';
NOTICE:  argument type base_type is only a shell
CREATE FUNCTION
yugabyte=# CREATE FUNCTION base_type_recv(internal) RETURNS base_type
yugabyte-#    LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE AS 'int2recv';
NOTICE:  return type base_type is only a shell
CREATE FUNCTION
yugabyte=# CREATE FUNCTION base_type_send(base_type) RETURNS bytea
yugabyte-#    LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE AS 'int2send';
NOTICE:  argument type base_type is only a shell
CREATE FUNCTION
```

2. In a second session:
```
yugabyte=# CREATE TABLE default_test (f1 base_type, f2 int);
ERROR:  type "base_type" is only a shell
LINE 1: CREATE TABLE default_test (f1 base_type, f2 int);
```
This ERROR is expected.

3. Back to the first session to fill the definition of the shell type

```
yugabyte=# CREATE TYPE base_type (
yugabyte(#    INPUT = base_type_in,
yugabyte(#    OUTPUT = base_type_out,
yugabyte(#    RECEIVE = base_type_recv,
yugabyte(#    SEND = base_type_send,
yugabyte(#    LIKE = smallint,
yugabyte(#    CATEGORY = 'N',
yugabyte(#    PREFERRED = FALSE,
yugabyte(#    DELIMITER = ',',
yugabyte(#    COLLATABLE = FALSE
yugabyte(# ); -- fill definition
CREATE TYPE
```

4. Back to the second session
```
yugabyte=# CREATE TABLE default_test (f1 base_type, f2 int);
ERROR:  type "base_type" is only a shell
LINE 1: CREATE TABLE default_test (f1 base_type, f2 int);
```

This ERROR is not expected because the first session has already filled the
definition of the shell type.

To fix this bug I added code to detect the update of an existing shell type and
make this DDL to increment the catalog version.

A new unit test is added.
Jira: DB-13103

Test Plan: ./yb_build.sh debug --cxx-test pgwrapper_pg_libpq-test --gtest_filter=PgLibPqTest.FillShellTypeDefinition

Reviewers: kfranz, mihnea

Reviewed By: kfranz

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D38575
timothy-e pushed a commit that referenced this issue Oct 2, 2024
Summary:
 79a00fd [PLAT-15307]fix sensitive info leaks via Gflags
 cd26c93 [DOC-487] Voyager 1.8.2 changes (#24177)
 fa91de7 [docs] Apache Hudi integration with YSQL  (#23888)
 586d337 Updating DynamoDB comparison (#24216)
 aad5695 [#18822] YSQL: Promote autoflag to skip redundant update operations
 fa38152 Fix UBI image: Add -y option to install of hostname
 6baf188 [#23998] Update third-party dependencies and enable SimSIMD in Usearch
 d57db29 Automatic commit by thirdparty_tool: update usearch to commit 191d9bb46fe5e2a44d1505ce7563ed51c7e55868.
 aab1a8b Automatic commit by thirdparty_tool: update simsimd to tag v5.4.3-yb-1.
 161c0c8 [PLAT-15279] Adding unix timestamp to the core dump
 17c45ff [#24217] YSQL: fill definition of a shell type requires catalog version increment
 037fac0 [DB-13062] yugabyted: added banner and get started component
 2eedabd [doc] Read replica connection load balancing support in JDBC Smart driver (#24006)
 62a6a32 [#21467, #24153] Docdb: Add Read sequences as of time - sequences support for clone part 2
 12de78e [PLAT-14954] added support for systemd-timesyncd
 4a07eb8 [#23988] YSQL: Skip a table for schema comparison if its schema does not change
 d3fd39f [doc][ybm] Add reasoning behind no access to yugabyte user #21105 (#23930)
 556ba8a [PLAT-15074] Install node agents on nodes for the marked universes for on-prem providers
 9beb6dc [#22710][#22707] yugabyted: Update voyager migrations list landing page. (#22834)
 6128137 [PLAT-15545] Simplify the frozen universe message for end user in YBA
 4e36b78 JDBC Driver version update to 42.3.5-yb-8 (#24241)
 254c979 [PLAT-15519]: Update xCluster sync to remove tables from YBA DB

Test Plan: Jenkins: rebase: pg15-cherrypicks

Reviewers: tfoucher, fizaa, telgersma

Differential Revision: https://phorge.dev.yugabyte.com/D38624
myang2021 added a commit that referenced this issue Oct 2, 2024
…res catalog version increment

Summary:
Steps to repro:

1. In one ysqlsh session:
```
yugabyte=# CREATE TYPE base_type; -- create shell type
CREATE TYPE
yugabyte=# CREATE FUNCTION base_type_in(cstring) RETURNS base_type
yugabyte-#    LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE AS 'int2in';
NOTICE:  return type base_type is only a shell
CREATE FUNCTION
yugabyte=# CREATE FUNCTION base_type_out(base_type) RETURNS cstring
yugabyte-#    LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE AS 'int2out';
NOTICE:  argument type base_type is only a shell
CREATE FUNCTION
yugabyte=# CREATE FUNCTION base_type_recv(internal) RETURNS base_type
yugabyte-#    LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE AS 'int2recv';
NOTICE:  return type base_type is only a shell
CREATE FUNCTION
yugabyte=# CREATE FUNCTION base_type_send(base_type) RETURNS bytea
yugabyte-#    LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE AS 'int2send';
NOTICE:  argument type base_type is only a shell
CREATE FUNCTION
```

2. In a second session:
```
yugabyte=# CREATE TABLE default_test (f1 base_type, f2 int);
ERROR:  type "base_type" is only a shell
LINE 1: CREATE TABLE default_test (f1 base_type, f2 int);
```
This ERROR is expected.

3. Back to the first session to fill the definition of the shell type

```
yugabyte=# CREATE TYPE base_type (
yugabyte(#    INPUT = base_type_in,
yugabyte(#    OUTPUT = base_type_out,
yugabyte(#    RECEIVE = base_type_recv,
yugabyte(#    SEND = base_type_send,
yugabyte(#    LIKE = smallint,
yugabyte(#    CATEGORY = 'N',
yugabyte(#    PREFERRED = FALSE,
yugabyte(#    DELIMITER = ',',
yugabyte(#    COLLATABLE = FALSE
yugabyte(# ); -- fill definition
CREATE TYPE
```

4. Back to the second session
```
yugabyte=# CREATE TABLE default_test (f1 base_type, f2 int);
ERROR:  type "base_type" is only a shell
LINE 1: CREATE TABLE default_test (f1 base_type, f2 int);
```

This ERROR is not expected because the first session has already filled the
definition of the shell type.

To fix this bug I added code to detect the update of an existing shell type and
make this DDL to increment the catalog version.

A new unit test is added.
Jira: DB-13103

Original commit: 17c45ff / D38575

Test Plan: ./yb_build.sh debug --cxx-test pgwrapper_pg_libpq-test --gtest_filter=PgLibPqTest.FillShellTypeDefinition

Reviewers: kfranz, mihnea

Reviewed By: kfranz

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D38614
myang2021 added a commit that referenced this issue Oct 2, 2024
…res catalog version increment

Summary:
Steps to repro:

1. In one ysqlsh session:
```
yugabyte=# CREATE TYPE base_type; -- create shell type
CREATE TYPE
yugabyte=# CREATE FUNCTION base_type_in(cstring) RETURNS base_type
yugabyte-#    LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE AS 'int2in';
NOTICE:  return type base_type is only a shell
CREATE FUNCTION
yugabyte=# CREATE FUNCTION base_type_out(base_type) RETURNS cstring
yugabyte-#    LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE AS 'int2out';
NOTICE:  argument type base_type is only a shell
CREATE FUNCTION
yugabyte=# CREATE FUNCTION base_type_recv(internal) RETURNS base_type
yugabyte-#    LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE AS 'int2recv';
NOTICE:  return type base_type is only a shell
CREATE FUNCTION
yugabyte=# CREATE FUNCTION base_type_send(base_type) RETURNS bytea
yugabyte-#    LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE AS 'int2send';
NOTICE:  argument type base_type is only a shell
CREATE FUNCTION
```

2. In a second session:
```
yugabyte=# CREATE TABLE default_test (f1 base_type, f2 int);
ERROR:  type "base_type" is only a shell
LINE 1: CREATE TABLE default_test (f1 base_type, f2 int);
```
This ERROR is expected.

3. Back to the first session to fill the definition of the shell type

```
yugabyte=# CREATE TYPE base_type (
yugabyte(#    INPUT = base_type_in,
yugabyte(#    OUTPUT = base_type_out,
yugabyte(#    RECEIVE = base_type_recv,
yugabyte(#    SEND = base_type_send,
yugabyte(#    LIKE = smallint,
yugabyte(#    CATEGORY = 'N',
yugabyte(#    PREFERRED = FALSE,
yugabyte(#    DELIMITER = ',',
yugabyte(#    COLLATABLE = FALSE
yugabyte(# ); -- fill definition
CREATE TYPE
```

4. Back to the second session
```
yugabyte=# CREATE TABLE default_test (f1 base_type, f2 int);
ERROR:  type "base_type" is only a shell
LINE 1: CREATE TABLE default_test (f1 base_type, f2 int);
```

This ERROR is not expected because the first session has already filled the
definition of the shell type.

To fix this bug I added code to detect the update of an existing shell type and
make this DDL to increment the catalog version.

A new unit test is added.
Jira: DB-13103

Original commit: 17c45ff / D38575

Test Plan: ./yb_build.sh debug --cxx-test pgwrapper_pg_libpq-test --gtest_filter=PgLibPqTest.FillShellTypeDefinition

Reviewers: kfranz, mihnea

Reviewed By: kfranz

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D38615
myang2021 added a commit that referenced this issue Oct 4, 2024
…s catalog version increment

Summary:
Steps to repro:

1. In one ysqlsh session:
```
yugabyte=# CREATE TYPE base_type; -- create shell type
CREATE TYPE
yugabyte=# CREATE FUNCTION base_type_in(cstring) RETURNS base_type
yugabyte-#    LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE AS 'int2in';
NOTICE:  return type base_type is only a shell
CREATE FUNCTION
yugabyte=# CREATE FUNCTION base_type_out(base_type) RETURNS cstring
yugabyte-#    LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE AS 'int2out';
NOTICE:  argument type base_type is only a shell
CREATE FUNCTION
yugabyte=# CREATE FUNCTION base_type_recv(internal) RETURNS base_type
yugabyte-#    LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE AS 'int2recv';
NOTICE:  return type base_type is only a shell
CREATE FUNCTION
yugabyte=# CREATE FUNCTION base_type_send(base_type) RETURNS bytea
yugabyte-#    LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE AS 'int2send';
NOTICE:  argument type base_type is only a shell
CREATE FUNCTION
```

2. In a second session:
```
yugabyte=# CREATE TABLE default_test (f1 base_type, f2 int);
ERROR:  type "base_type" is only a shell
LINE 1: CREATE TABLE default_test (f1 base_type, f2 int);
```
This ERROR is expected.

3. Back to the first session to fill the definition of the shell type

```
yugabyte=# CREATE TYPE base_type (
yugabyte(#    INPUT = base_type_in,
yugabyte(#    OUTPUT = base_type_out,
yugabyte(#    RECEIVE = base_type_recv,
yugabyte(#    SEND = base_type_send,
yugabyte(#    LIKE = smallint,
yugabyte(#    CATEGORY = 'N',
yugabyte(#    PREFERRED = FALSE,
yugabyte(#    DELIMITER = ',',
yugabyte(#    COLLATABLE = FALSE
yugabyte(# ); -- fill definition
CREATE TYPE
```

4. Back to the second session
```
yugabyte=# CREATE TABLE default_test (f1 base_type, f2 int);
ERROR:  type "base_type" is only a shell
LINE 1: CREATE TABLE default_test (f1 base_type, f2 int);
```

This ERROR is not expected because the first session has already filled the
definition of the shell type.

To fix this bug I added code to detect the update of an existing shell type and
make this DDL to increment the catalog version.

A new unit test is added.
Jira: DB-13103

Original commit: 17c45ff / D38575

Test Plan: ./yb_build.sh debug --cxx-test pgwrapper_pg_libpq-test --gtest_filter=PgLibPqTest.FillShellTypeDefinition

Reviewers: kfranz, mihnea

Reviewed By: kfranz

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D38697
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ycql Yugabyte CQL (YCQL) kind/bug This issue is a bug priority/medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

2 participants