|
24 | 24 | */ |
25 | 25 | #include "postgres.h" |
26 | 26 |
|
27 | | -#include "miscadmin.h" |
28 | 27 | #include "access/heapam.h" |
29 | 28 | #include "access/reloptions.h" |
30 | 29 | #include "access/tableam.h" |
|
35 | 34 | #include "commands/matview.h" |
36 | 35 | #include "commands/prepare.h" |
37 | 36 | #include "commands/tablecmds.h" |
38 | | -#include "commands/tablespace.h" |
39 | 37 | #include "commands/view.h" |
40 | 38 | #include "executor/execdesc.h" |
41 | 39 | #include "executor/executor.h" |
@@ -160,23 +158,8 @@ create_ctas_internal(List *attrList, IntoClause *into) |
160 | 158 | /* tablespace */ |
161 | 159 | atcmd = makeNode(AlterTableCmd); |
162 | 160 | atcmd->subtype = AT_SetTableSpace; |
163 | | - if (into->tableSpaceName != NULL) |
164 | | - atcmd->name = into->tableSpaceName; |
165 | | - else |
166 | | - { |
167 | | - Oid spcid; |
168 | | - |
169 | | - /* |
170 | | - * Resolve the name of the default or database tablespace because |
171 | | - * we need to specify the tablespace by name. |
172 | | - * |
173 | | - * TODO: Move that to ATPrepSetTableSpace? Must allow AlterTableCmd.name to be NULL then. |
174 | | - */ |
175 | | - spcid = GetDefaultTablespace(RELPERSISTENCE_PERMANENT, false); |
176 | | - if (!OidIsValid(spcid)) |
177 | | - spcid = MyDatabaseTableSpace; |
178 | | - atcmd->name = get_tablespace_name(spcid); |
179 | | - } |
| 161 | + /* use empty string to specify default tablespace */ |
| 162 | + atcmd->name = into->tableSpaceName ? into->tableSpaceName : ""; |
180 | 163 | atcmds = lappend(atcmds, atcmd); |
181 | 164 |
|
182 | 165 | /* storage options */ |
|
0 commit comments