1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-09 06:21:09 +03:00

Fix another bit of unlogged-table-induced breakage.

Per bug #6205, reported by Abel Abraham Camarillo Ojeda.  This isn't a
particularly elegant fix, but I'm trying to minimize the chances of
causing yet another round of breakage.

Adjust regression tests to exercise this case.
This commit is contained in:
Robert Haas
2011-09-21 10:32:30 -04:00
parent 2562dcea81
commit 4893552e21
3 changed files with 36 additions and 22 deletions

View File

@@ -225,7 +225,6 @@ RangeVarGetRelid(const RangeVar *relation, LOCKMODE lockmode, bool missing_ok,
bool nowait)
{
uint64 inval_count;
Oid namespaceId;
Oid relId;
Oid oldRelId = InvalidOid;
bool retry = false;
@@ -278,17 +277,27 @@ RangeVarGetRelid(const RangeVar *relation, LOCKMODE lockmode, bool missing_ok,
*/
if (relation->relpersistence == RELPERSISTENCE_TEMP)
{
if (relation->schemaname)
ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
errmsg("temporary tables cannot specify a schema name")));
if (OidIsValid(myTempNamespace))
if (!OidIsValid(myTempNamespace))
relId = InvalidOid; /* this probably can't happen? */
else
{
if (relation->schemaname)
{
Oid namespaceId;
namespaceId = LookupExplicitNamespace(relation->schemaname);
if (namespaceId != myTempNamespace)
ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
errmsg("temporary tables cannot specify a schema name")));
}
relId = get_relname_relid(relation->relname, myTempNamespace);
else /* this probably can't happen? */
relId = InvalidOid;
}
}
else if (relation->schemaname)
{
Oid namespaceId;
/* use exact schema given */
namespaceId = LookupExplicitNamespace(relation->schemaname);
relId = get_relname_relid(relation->relname, namespaceId);