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] "create table" not supported in a "template" database #15221

Open
bllewell opened this issue Dec 5, 2022 · 0 comments
Open

[YSQL] "create table" not supported in a "template" database #15221

bllewell opened this issue Dec 5, 2022 · 0 comments
Labels
area/ysql Yugabyte SQL (YSQL) kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue

Comments

@bllewell
Copy link
Contributor

bllewell commented Dec 5, 2022

Jira Link: DB-4400

Description

This is YB-2.15.3.2.

The attempt to create either a regular table or a temporary table in a "template" database causes this warning:

This statement is not supported in template0/template1 yet

and the hint says "raise a GitHub issue". Notice that this is a warning and not an error—and the attempt does actually create a table. But the result isn't trustworthy.

Note: The warning's wording is, in general, too narrow. Vanilla PG lets you create template databases with whatever names you want. However, through YB-2.15.3.2 you cannot do this. The attempt causes "Value other than default or false for is_template option is not yet supported". This shows that the "template" functionality is far from complete.

Because the attempt actually does create a table, I went ahead and populated a test table. But the attempt to create a new database with reference to my customized template caused its own errors.

Use case

I want to make some data available in all user-created databases. (It happens to be data from the Wikipedia page "List of tz database time zones".) The larger purpose is described in the YSQL doc in the section "The extended_timezone_names view".

The details don't matter. It's just an example of a completely ordinary template customization use case: make any kind of reference data automatically available in any database.

Further, the raw data from the Wikipedia page needs some post-processing. So it's natural to load it (with the "\copy" metacommand) into a temporary staging table and to use this as the source for the permanent target table. This is a classic use case for a temporary table—and it works fine (in a template database) in vanilla PG Version 11. So when this limitation is removed, it's essential that temporary tables are supported in a template database too.

@bllewell bllewell added area/ysql Yugabyte SQL (YSQL) status/awaiting-triage Issue awaiting triage labels Dec 5, 2022
@yugabyte-ci yugabyte-ci added kind/bug This issue is a bug priority/medium Medium priority issue labels Dec 5, 2022
@bllewell bllewell changed the title [YSQL] "create temporary table" not supported in a "template" database [YSQL] "create table" not supported in a "template" database Dec 6, 2022
@yugabyte-ci yugabyte-ci added kind/enhancement This is an enhancement of an existing feature and removed kind/bug This issue is a bug status/awaiting-triage Issue awaiting triage labels Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL) kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

3 participants