Changeset: 10d743d70ba1 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=10d743d70ba1 Modified Files: sql/backends/monet5/sql_cat.c sql/common/sql_changeset.c sql/include/sql_catalog.h sql/server/rel_distribute.c sql/server/rel_optimizer.c sql/server/rel_propagate.c sql/server/rel_schema.c sql/server/rel_select.c sql/server/rel_updates.c sql/server/sql_partition.c sql/storage/store.c Branch: default Log Message:
members -> list diffs (truncated from 526 to 300 lines): diff --git a/sql/backends/monet5/sql_cat.c b/sql/backends/monet5/sql_cat.c --- a/sql/backends/monet5/sql_cat.c +++ b/sql/backends/monet5/sql_cat.c @@ -153,7 +153,7 @@ validate_alter_table_add_table(mvc *sql, const char *errtable = TABLE_TYPE_DESCRIPTION(rmt->type, rmt->properties); if (!update && (!isMergeTable(rmt) && !isReplicaTable(rmt))) throw(SQL,call,SQLSTATE(42S02) "ALTER TABLE: cannot add table '%s.%s' to %s '%s.%s'", psname, ptname, errtable, msname, mtname); - node *n = members_find_child_id(rmt->members.set, rpt->base.id); + node *n = members_find_child_id(rmt->members, rpt->base.id); if (isView(rpt)) throw(SQL,call,SQLSTATE(42000) "ALTER TABLE: can't add a view into a %s", errtable); if (isDeclaredTable(rpt)) @@ -421,7 +421,7 @@ alter_table_del_table(mvc *sql, char *ms const char *errtable = TABLE_TYPE_DESCRIPTION(mt->type, mt->properties); if (!isMergeTable(mt) && !isReplicaTable(mt)) throw(SQL,"sql.alter_table_del_table",SQLSTATE(42S02) "ALTER TABLE: cannot drop table '%s.%s' to %s '%s.%s'", psname, ptname, errtable, msname, mtname); - if (!(n = members_find_child_id(mt->members.set, pt->base.id))) + if (!(n = members_find_child_id(mt->members, pt->base.id))) throw(SQL,"sql.alter_table_del_table",SQLSTATE(42S02) "ALTER TABLE: table '%s.%s' isn't part of %s '%s.%s'", ps->base.name, ptname, errtable, ms->base.name, mtname); if (sql_trans_del_table(sql->session->tr, mt, pt, drop_action)) @@ -1733,7 +1733,7 @@ SQLrename_table(Client cntxt, MalBlkPtr throw(SQL, "sql.rename_table", SQLSTATE(42000) "ALTER TABLE: not possible to change schema of a view"); if (isDeclaredTable(t)) throw(SQL, "sql.rename_table", SQLSTATE(42000) "ALTER TABLE: not possible to change schema of a declared table"); - if (mvc_check_dependency(sql, t->base.id, TABLE_DEPENDENCY, NULL) || cs_size(&t->members) || ol_length(t->triggers)) + if (mvc_check_dependency(sql, t->base.id, TABLE_DEPENDENCY, NULL) || list_length(t->members) || ol_length(t->triggers)) throw(SQL, "sql.rename_table", SQLSTATE(2BM37) "ALTER TABLE: unable to set schema of table '%s' (there are database objects which depend on it)", otable_name); if (!(s = mvc_bind_schema(sql, nschema_name))) throw(SQL, "sql.rename_table", SQLSTATE(42S02) "ALTER TABLE: no such schema '%s'", nschema_name); diff --git a/sql/common/sql_changeset.c b/sql/common/sql_changeset.c --- a/sql/common/sql_changeset.c +++ b/sql/common/sql_changeset.c @@ -41,25 +41,6 @@ cs_add(changeset * cs, void *elm, int fl cs->nelm = cs->set->t; } -void * -cs_transverse_with_validate(changeset * cs, void *elm, void *extra, fvalidate cmp) -{ - return list_transverse_with_validate(cs->set, elm, extra, cmp); -} - -void * -cs_add_with_validate(changeset * cs, void *elm, void *extra, int flags, fvalidate cmp) -{ - void* res = NULL; - if (!cs->set) - cs->set = list_new(cs->sa, cs->destroy); - if((res = list_append_with_validate(cs->set, elm, extra, cmp)) != NULL) - return res; - if (newFlagSet(flags) && !cs->nelm) - cs->nelm = cs->set->t; - return res; -} - void cs_del(changeset * cs, void *gdata, node *elm, int flags) { diff --git a/sql/include/sql_catalog.h b/sql/include/sql_catalog.h --- a/sql/include/sql_catalog.h +++ b/sql/include/sql_catalog.h @@ -276,9 +276,7 @@ extern node *ol_rehash(objlist *ol, cons extern void cs_new(changeset * cs, sql_allocator *sa, fdestroy destroy); extern void cs_destroy(changeset * cs, void *data); extern void cs_add(changeset * cs, void *elm, int flag); -extern void *cs_add_with_validate(changeset * cs, void *elm, void *extra, int flag, fvalidate cmp); extern void cs_del(changeset * cs, void *gdata, node *elm, int flag); -extern void *cs_transverse_with_validate(changeset * cs, void *elm, void *extra, fvalidate cmp); extern int cs_size(changeset * cs); extern node *cs_find_id(changeset * cs, sqlid id); @@ -706,7 +704,7 @@ typedef struct sql_table { objlist *idxs; objlist *keys; objlist *triggers; - changeset members; /* member tables of merge/replica tables */ + list *members; /* member tables of merge/replica tables */ int drop_action; /* only needed for alter drop table */ ATOMIC_PTR_TYPE data; diff --git a/sql/server/rel_distribute.c b/sql/server/rel_distribute.c --- a/sql/server/rel_distribute.c +++ b/sql/server/rel_distribute.c @@ -195,7 +195,7 @@ replica(mvc *sql, sql_rel *rel, char *ur if (uri) { /* replace by the replica which matches the uri */ - for (n = t->members.set->h; n; n = n->next) { + for (n = t->members->h; n; n = n->next) { sql_part *p = n->data; sql_table *pt = find_sql_table_id(sql->session->tr, t->s, p->member); @@ -205,10 +205,10 @@ replica(mvc *sql, sql_rel *rel, char *ur } } } else { /* no match, find one without remote or use first */ - if (t->members.set) { + if (t->members) { int fnd = 0; sql_part *p; - for (n = t->members.set->h; n; n = n->next) { + for (n = t->members->h; n; n = n->next) { sql_part *p = n->data; sql_table *pt = find_sql_table_id(sql->session->tr, t->s, p->member); @@ -219,7 +219,7 @@ replica(mvc *sql, sql_rel *rel, char *ur } } if (!fnd) { - p = t->members.set->h->data; + p = t->members->h->data; rel = rewrite_replica(sql, rel, t, p, 1); } } else { diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -83,7 +83,7 @@ name_find_column( sql_rel *rel, const ch if (strcmp(c->base.name, name) == 0) { *bt = rel; if (pnr < 0 || (mt && - find_member_pos(mt->members.set, c->t) == pnr)) + find_member_pos(mt->members, c->t) == pnr)) return c; } } @@ -93,7 +93,7 @@ name_find_column( sql_rel *rel, const ch if (strcmp(i->base.name, name+1 /* skip % */) == 0) { *bt = rel; if (pnr < 0 || (mt && - find_member_pos(mt->members.set, i->t) == pnr)) { + find_member_pos(mt->members, i->t) == pnr)) { sql_kc *c = i->columns->h->data; return c->c; } @@ -4947,7 +4947,7 @@ rel_part_nr( sql_rel *rel, sql_exp *e ) return -1; sql_table *pp = c->t; sql_table *mt = bt->r; - return find_member_pos(mt->members.set, pp); + return find_member_pos(mt->members, pp); } static int @@ -4970,7 +4970,7 @@ rel_uses_part_nr( sql_rel *rel, sql_exp if (c && bt && bt->r) { sql_table *pp = c->t; sql_table *mt = bt->r; - if (find_member_pos(mt->members.set, pp) == pnr) + if (find_member_pos(mt->members, pp) == pnr) return 1; } /* for projects we may need to do a rename! */ @@ -8898,7 +8898,7 @@ rel_merge_table_rewrite(visitor *v, sql_ char *tname = t->base.name; list *cols = NULL, *ranges = NULL; - if (cs_size(&t->members)==0) + if (list_length(t->members)==0) return rel; if (sel) { cols = sa_list(v->sql->sa); @@ -8953,10 +8953,10 @@ rel_merge_table_rewrite(visitor *v, sql_ } } v->changes++; - if (t->members.set) { + if (t->members) { list *tables = sa_list(v->sql->sa); - for (node *nt = t->members.set->h; nt; nt = nt->next) { + for (node *nt = t->members->h; nt; nt = nt->next) { sql_part *pd = nt->data; sql_table *pt = find_sql_table_id(v->sql->session->tr, t->s, pd->member); sql_rel *prel = rel_basetable(v->sql, pt, tname), *bt = NULL; @@ -9252,7 +9252,7 @@ rel_merge_table_rewrite(visitor *v, sql_ tables = ntables; } } - if (nrel && cs_size(&t->members) == 1) { + if (nrel && list_length(t->members) == 1) { nrel = rel_project(v->sql->sa, nrel, rel->exps); } else if (nrel) { rel_set_exps(nrel, rel->exps); diff --git a/sql/server/rel_propagate.c b/sql/server/rel_propagate.c --- a/sql/server/rel_propagate.c +++ b/sql/server/rel_propagate.c @@ -597,7 +597,7 @@ rel_generate_subdeletes(mvc *sql, sql_re int just_one = 1; sql_rel *sel = NULL; - for (node *n = t->members.set->h; n; n = n->next) { + for (node *n = t->members->h; n; n = n->next) { sql_part *pt = (sql_part *) n->data; sql_table *sub = find_sql_table_id(sql->session->tr, t->s, pt->member); sql_rel *s1, *dup = NULL; @@ -631,7 +631,7 @@ rel_generate_subupdates(mvc *sql, sql_re int just_one = 1; sql_rel *sel = NULL; - for (node *n = t->members.set->h; n; n = n->next) { + for (node *n = t->members->h; n; n = n->next) { sql_part *pt = (sql_part *) n->data; sql_table *sub = find_sql_table_id(sql->session->tr, t->s, pt->member); sql_rel *s1, *dup = NULL; @@ -701,7 +701,7 @@ rel_generate_subinserts(sql_query *query } anti_le = rel_generate_anti_insert_expression(sql, &anti_rel, t); - for (node *n = t->members.set->h; n; n = n->next) { + for (node *n = t->members->h; n; n = n->next) { sql_part *pt = (sql_part *) n->data; sql_table *sub = find_sql_table_id(sql->session->tr, t->s, pt->member); sql_rel *s1 = NULL, *dup = NULL; @@ -1076,7 +1076,7 @@ rel_propagate(sql_query *query, sql_rel } } if (isMergeTable(t)) { - assert(cs_size(&t->members)); + assert(list_length(t->members)); if (is_delete(propagate->op) || is_truncate(propagate->op)) { /* propagate deletions to the partitions */ rel = rel_propagate_delete(sql, rel, t, changes); } else if (isRangePartitionTable(t) || isListPartitionTable(t)) { diff --git a/sql/server/rel_schema.c b/sql/server/rel_schema.c --- a/sql/server/rel_schema.c +++ b/sql/server/rel_schema.c @@ -645,12 +645,12 @@ create_column(sql_query *query, symbol * int res = SQL_OK; (void) ss; - if (alter && !(isTable(t) || (isMergeTable(t) && cs_size(&t->members)==0))) { + if (alter && !(isTable(t) || (isMergeTable(t) && list_length(t->members)==0))) { sql_error(sql, 02, SQLSTATE(42000) "ALTER TABLE: cannot add column to %s '%s'%s\n", isMergeTable(t)?"MERGE TABLE": isRemote(t)?"REMOTE TABLE": isReplicaTable(t)?"REPLICA TABLE":"VIEW", - t->base.name, (isMergeTable(t) && cs_size(&t->members)) ? " while it has partitions" : ""); + t->base.name, (isMergeTable(t) && list_length(t->members)) ? " while it has partitions" : ""); return SQL_ERR; } if (l->h->next->next) @@ -682,7 +682,7 @@ table_element(sql_query *query, symbol * if (alter && (isView(t) || - ((isMergeTable(t) || isReplicaTable(t)) && (s->token != SQL_TABLE && s->token != SQL_DROP_TABLE && cs_size(&t->members))) || + ((isMergeTable(t) || isReplicaTable(t)) && (s->token != SQL_TABLE && s->token != SQL_DROP_TABLE && list_length(t->members))) || (isTable(t) && (s->token == SQL_TABLE || s->token == SQL_DROP_TABLE)) || (partition_find_part(sql->session->tr, t, NULL) && (s->token == SQL_DROP_COLUMN || s->token == SQL_COLUMN || s->token == SQL_CONSTRAINT || @@ -731,7 +731,7 @@ table_element(sql_query *query, symbol * isMergeTable(t)?"MERGE TABLE": isRemote(t)?"REMOTE TABLE": isReplicaTable(t)?"REPLICA TABLE":"VIEW", - t->base.name, (isMergeTable(t) && cs_size(&t->members)) ? " while it has partitions" : ""); + t->base.name, (isMergeTable(t) && list_length(t->members)) ? " while it has partitions" : ""); return SQL_ERR; } @@ -1443,7 +1443,7 @@ sql_alter_table(sql_query *query, dlist } return rel_alter_table(sql->sa, ddl_alter_table_add_table, sname, tname, nsname, ntname, 0); } - if ((isMergeTable(pt) || isReplicaTable(pt)) && cs_size(&pt->members)==0) + if ((isMergeTable(pt) || isReplicaTable(pt)) && list_length(pt->members)==0) return sql_error(sql, 02, SQLSTATE(42000) "The %s %s.%s should have at least one table associated", TABLE_TYPE_DESCRIPTION(pt->type, pt->properties), pt->s->base.name, pt->base.name); @@ -2305,7 +2305,7 @@ rel_set_table_schema(sql_query *query, c return sql_error(sql, 02, SQLSTATE(42000) "ALTER TABLE: not possible to change a temporary table schema"); if (isView(ot)) return sql_error(sql, 02, SQLSTATE(42000) "ALTER TABLE: not possible to change schema of a view"); - if (mvc_check_dependency(sql, ot->base.id, TABLE_DEPENDENCY, NULL) || cs_size(&ot->members) || ol_length(ot->triggers)) + if (mvc_check_dependency(sql, ot->base.id, TABLE_DEPENDENCY, NULL) || list_length(ot->members) || ol_length(ot->triggers)) return sql_error(sql, 02, SQLSTATE(2BM37) "ALTER TABLE: unable to set schema of table '%s' (there are database objects which depend on it)", tname); if (!(ns = mvc_bind_schema(sql, new_schema))) return sql_error(sql, ERR_NOTFOUND, SQLSTATE(42S02) "ALTER TABLE: no such schema '%s'", new_schema); diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c --- a/sql/server/rel_select.c +++ b/sql/server/rel_select.c @@ -992,7 +992,7 @@ table_ref(sql_query *query, sql_rel *rel return sql_error(sql, 02, SQLSTATE(42000) "SELECT: access denied for %s to view '%s.%s'", get_string_global_var(sql, "current_user"), t->s->base.name, tname); return rel; } - if ((isMergeTable(t) || isReplicaTable(t)) && cs_size(&t->members)==0) + if ((isMergeTable(t) || isReplicaTable(t)) && list_length(t->members)==0) return sql_error(sql, 02, SQLSTATE(42000) "MERGE or REPLICA TABLE should have at least one table associated"); res = rel_basetable(sql, t, tname); if (!allowed) { diff --git a/sql/server/rel_updates.c b/sql/server/rel_updates.c --- a/sql/server/rel_updates.c +++ b/sql/server/rel_updates.c @@ -382,7 +382,7 @@ insert_allowed(mvc *sql, sql_table *t, c return sql_error(sql, 02, SQLSTATE(42000) "%s: cannot %s view '%s'", op, opname, tname); } else if (isNonPartitionedTable(t)) { return sql_error(sql, 02, SQLSTATE(42000) "%s: cannot %s merge table '%s'", op, opname, tname); - } else if ((isRangePartitionTable(t) || isListPartitionTable(t)) && cs_size(&t->members)==0) { + } else if ((isRangePartitionTable(t) || isListPartitionTable(t)) && list_length(t->members)==0) { return sql_error(sql, 02, SQLSTATE(42000) "%s: %s partitioned table '%s' has no partitions set", op, isListPartitionTable(t)?"list":"range", tname); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list