Bug? CREATE TABLE AS (... UNION ...)
От | Gregory Stark |
---|---|
Тема | Bug? CREATE TABLE AS (... UNION ...) |
Дата | |
Msg-id | 87fy9saif3.fsf@stark.xeocode.com обсуждение исходный текст |
Ответы |
Re: Bug? CREATE TABLE AS (... UNION ...)
|
Список | pgsql-hackers |
I think I found a bug, or at least a discrepancy. Afaict the transformSetOperationsStmt function should have identical code to transformSelectStmt outside of the operations affected by set operations. If that's the case then the SELECT INTO/CREATE TABLE AS code was not updated when last it was touched for regular queries. I think this means WITH[OUT] OIDS and WITH <definition> won't currently work correctly if the select query involves a UNION or other set operation. Also temporary tables created with an ON COMMIT option will ignore it and any tablespace directive will be ignored. Should I just copy the same code over or is anyone interested in refactoring this? Or do I have it wrong somehow? TransformSelectStmt: /* handle any SELECT INTO/CREATE TABLE AS spec */if (stmt->into){ qry->into = stmt->into; if (stmt->intoColNames) applyColumnNames(qry->targetList, stmt->intoColNames); qry->intoOptions = copyObject(stmt->intoOptions); qry->intoOnCommit= stmt->intoOnCommit; qry->intoTableSpaceName = stmt->intoTableSpaceName;} transformSetOperationStmt: /* * Handle SELECT INTO/CREATE TABLE AS. * * Any column names from CREATE TABLE AS need to be attached to both the * toplevel and the leftmost subquery. We do not do this earlier because * we do *not* want sortClause processing to be affected.*/if (intoColNames){ applyColumnNames(qry->targetList, intoColNames); applyColumnNames(leftmostQuery->targetList,intoColNames);} -- Gregory Stark EnterpriseDB http://www.enterprisedb.com
В списке pgsql-hackers по дате отправления: