Fix to allow generate_sereis in FROM clause (#50)

Previously, it caused an error due to an ambiguous reference
at the maintenance time because generate_series is used internally.
This is fixed by using an alias name for the internal genearet_series.
This commit is contained in:
Yugo Nagata 2023-01-26 16:58:20 +09:00 committed by GitHub
parent 0e581c16e7
commit e00ff9dd32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2347,7 +2347,7 @@ apply_new_delta(const char *matviewname, const char *deltaname_new,
initStringInfo(&querybuf);
appendStringInfo(&querybuf,
"INSERT INTO %s (%s) SELECT %s FROM ("
"SELECT diff.*, generate_series(1, diff.\"__ivm_count__\") "
"SELECT diff.*, generate_series(1, diff.\"__ivm_count__\") AS __ivm_generate_series__ "
"FROM %s AS diff) AS v",
matviewname, target_list->data, target_list->data,
deltaname_new);