mirror of
https://github.com/HypoPG/hypopg
synced 2026-05-24 09:38:21 +00:00
Check for real table first in hypopg_add_partition()
For now, hypo_table_name_get_entry() can be quite slow if many hypoTable are present, so perform cheaper check before it.
This commit is contained in:
parent
aa8948d579
commit
a0d7faefc2
1 changed files with 4 additions and 4 deletions
|
|
@ -3291,14 +3291,14 @@ HYPO_PARTITION_NOT_SUPPORTED();
|
|||
if (!PG_ARGISNULL(2))
|
||||
partition_by = TextDatumGetCString(PG_GETARG_TEXT_PP(2));
|
||||
|
||||
if (hypo_table_name_get_entry(partname) != NULL)
|
||||
elog(ERROR, "hypopg: hypothetical table %s already exists",
|
||||
quote_identifier(partname));
|
||||
|
||||
if (RelnameGetRelid(partname) != InvalidOid)
|
||||
elog(ERROR, "hypopg: real table %s already exists",
|
||||
quote_identifier(partname));
|
||||
|
||||
if (hypo_table_name_get_entry(partname) != NULL)
|
||||
elog(ERROR, "hypopg: hypothetical table %s already exists",
|
||||
quote_identifier(partname));
|
||||
|
||||
tupdesc = CreateTemplateTupleDesc(HYPO_ADD_PART_COLS, false);
|
||||
TupleDescInitEntry(tupdesc, (AttrNumber) ++i, "relid", OIDOID, -1, 0);
|
||||
TupleDescInitEntry(tupdesc, (AttrNumber) ++i, "tablename", TEXTOID, -1, 0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue