mirror of
https://github.com/HypoPG/hypopg
synced 2026-05-23 17:18:44 +00:00
Fix failure with hypo index on unexisting table for pg10+.
This commit is contained in:
parent
b41bd64e69
commit
e7022704db
4 changed files with 19 additions and 3 deletions
|
|
@ -1,4 +1,8 @@
|
|||
-- Hypothetical index tests
|
||||
-- Hypothetical index on unexisting table
|
||||
SELECT COUNT(*) AS nb
|
||||
FROM public.hypopg_create_index('CREATE INDEX ON notatable(meh);');
|
||||
ERROR: relation "notatable" does not exist
|
||||
CREATE TABLE hypo (id integer, val text);
|
||||
INSERT INTO hypo SELECT i, 'line ' || i
|
||||
FROM generate_series(1,100000) f(i);
|
||||
|
|
|
|||
|
|
@ -352,7 +352,12 @@ hypo_index_store_parsetree(IndexStmt *node, const char *queryString)
|
|||
hypoTable *table = hypo_table_name_get_entry(rv->relname);
|
||||
|
||||
if (!table)
|
||||
elog(ERROR, "hypopg: table %s does not exists",
|
||||
/*
|
||||
* We use the same error message as postgres so users (and
|
||||
* regression tests) get a consistent message error before and
|
||||
* after pg10.
|
||||
*/
|
||||
elog(ERROR, "relation \"%s\" does not exist",
|
||||
quote_identifier(rv->relname));
|
||||
|
||||
if (table->partkey)
|
||||
|
|
|
|||
|
|
@ -1920,8 +1920,8 @@ hypo_find_table(Oid tableid, bool missing_ok)
|
|||
}
|
||||
|
||||
/*
|
||||
* Return the hypothetical oid if the given name is an hypothetical partition,
|
||||
* otherwise return InvalidOid
|
||||
* Return the hypothetical table if the given unqualified object name is an
|
||||
* hypothetical partition, otherwise return NULL.
|
||||
*/
|
||||
hypoTable *
|
||||
hypo_table_name_get_entry(const char *name)
|
||||
|
|
@ -1929,6 +1929,9 @@ hypo_table_name_get_entry(const char *name)
|
|||
HASH_SEQ_STATUS hash_seq;
|
||||
hypoTable *entry;
|
||||
|
||||
if (!hypoTables)
|
||||
return NULL;
|
||||
|
||||
hash_seq_init(&hash_seq, hypoTables);
|
||||
while ((entry = hash_seq_search(&hash_seq)) != NULL)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
-- Hypothetical index tests
|
||||
|
||||
-- Hypothetical index on unexisting table
|
||||
SELECT COUNT(*) AS nb
|
||||
FROM public.hypopg_create_index('CREATE INDEX ON notatable(meh);');
|
||||
|
||||
CREATE TABLE hypo (id integer, val text);
|
||||
|
||||
INSERT INTO hypo SELECT i, 'line ' || i
|
||||
|
|
|
|||
Loading…
Reference in a new issue