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

CREATE TABLE COLUMN ENCODING clause with non-existent column passes. #10115

Closed
hlinnaka opened this issue May 14, 2020 · 1 comment
Closed

CREATE TABLE COLUMN ENCODING clause with non-existent column passes. #10115

hlinnaka opened this issue May 14, 2020 · 1 comment

Comments

@hlinnaka
Copy link
Contributor

Actual behavior

postgres=# CREATE TABLE tab (
  i text,
  COLUMN non_existent ENCODING (compresstype=zlib)
)
with (appendonly=true, orientation=column);
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table.
HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE

Expected behavior

I expected an error, because there is no "non_existent" column. There is code specifically to check for that, in the validateColumnStorageEncodingClauses() function:

/*
 * Validate the sanity of column reference storage clauses.
 *
 * 1. Ensure that we only refer to columns that exist.
 * 2. Ensure that each column is referenced either zero times or once.
 */
static void
validateColumnStorageEncodingClauses(List *stenc, List *columns)
{
	...
	/*
	 * All column reference storage directives without the DEFAULT
	 * clause should refer to real columns.
	 */
	foreach(lc, stenc)
	{
		...

			if (!found)
				ereport(ERROR,
						(errcode(ERRCODE_WRONG_OBJECT_TYPE),
						 errmsg("column \"%s\" does not exist", colname)));

But that code is not being called correctly.

@hlinnaka
Copy link
Contributor Author

The other check in validateColumnStorageEncodingClauses(), for duplicated COLUMN ENCODING directives, is also broken:

postgres=# CREATE TABLE dupetab (
  dupe text,
  column dupe encoding (compresstype=zlib),
  column dupe encoding (compresstype=none)
)
with (appendonly=true, orientation=column);
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'dupe' as the Greenplum Database data distribution key for this table.
HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE

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