Changeset: 1265a6b6fa30 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1265a6b6fa30
Modified Files:
clients/mapiclient/dump.c
configure.ag
Branch: default
Log Message:
Merge with Aug2011 branch.
diffs (truncated from 393 to 300 lines):
diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -1668,8 +1668,11 @@ dump_database(Mapi mid, stream *toConsol
char *uname = mapi_fetch_field(hdl, 0);
char *rname = mapi_fetch_field(hdl, 1);
- mnstr_printf(toConsole, "GRANT \"%s\" TO \"%s\"",
- rname, uname);
+ mnstr_printf(toConsole, "GRANT \"%s\" TO ", rname);
+ if (strcmp(uname, "public") == 0)
+ mnstr_printf(toConsole, "PUBLIC");
+ else
+ mnstr_printf(toConsole, "\"%s\"", uname);
/* optional WITH ADMIN OPTION and FROM
(CURRENT_USER|CURRENT_ROLE) are ignored by
server, so we can't dump them */
diff --git a/clients/odbc/driver/SQLTablePrivileges.c
b/clients/odbc/driver/SQLTablePrivileges.c
--- a/clients/odbc/driver/SQLTablePrivileges.c
+++ b/clients/odbc/driver/SQLTablePrivileges.c
@@ -76,44 +76,50 @@ SQLTablePrivileges_(ODBCStmt *stmt,
query_end = query;
/* SQLTablePrivileges returns a table with the following columns:
- VARCHAR table_cat
- VARCHAR table_schem
- VARCHAR table_name NOT NULL
- VARCHAR grantor
- VARCHAR grantee NOT NULL
- VARCHAR privilege NOT NULL
- VARCHAR is_grantable
+ table_cat VARCHAR
+ table_schem VARCHAR
+ table_name VARCHAR NOT NULL
+ grantor VARCHAR
+ grantee VARCHAR NOT NULL
+ privilege VARCHAR NOT NULL
+ is_grantable VARCHAR
*/
sprintf(query_end,
"select"
- " cast(NULL as varchar(1)) as table_cat,"
- " s.name as table_schem,"
- " t.name as table_name,"
- " g.name as grantor,"
- " a.name as grantee,"
- " case p.privileges"
+ " cast(NULL as varchar(128)) as \"table_cat\","
+ " \"s\".\"name\" as \"table_schem\","
+ " \"t\".\"name\" as \"table_name\","
+ " case \"a\".\"id\""
+ " when \"s\".\"owner\" then '_SYSTEM'"
+ " else \"g\".\"name\""
+ " end as \"grantor\","
+ " case \"a\".\"name\""
+ " when 'public' then 'PUBLIC'"
+ " else \"a\".\"name\""
+ " end as \"grantee\","
+ " case \"p\".\"privileges\""
" when 1 then 'SELECT'"
" when 2 then 'UPDATE'"
" when 4 then 'INSERT'"
" when 8 then 'DELETE'"
" when 16 then 'EXECUTE'"
" when 32 then 'GRANT'"
- " end as privilege,"
- " case p.grantable"
+ " end as \"privilege\","
+ " case \"p\".\"grantable\""
" when 1 then 'YES'"
" when 0 then 'NO'"
- " end as grantable "
- "from schemas s,"
- " tables t,"
- " auths a,"
- " privileges p,"
- " auths g "
- "where p.obj_id = t.id"
- " and p.auth_id = a.id"
- " and t.schema_id = s.id"
- " and t.system = false"
- " and p.grantor = g.id");
+ " end as \"is_grantable\" "
+ "from \"sys\".\"schemas\" \"s\","
+ " \"sys\".\"_tables\" \"t\","
+ " \"sys\".\"auths\" \"a\","
+ " \"sys\".\"privileges\" \"p\","
+ " \"sys\".\"auths\" \"g\" "
+ "where \"p\".\"obj_id\" = \"t\".\"id\""
+ " and \"p\".\"auth_id\" = \"a\".\"id\""
+ " and \"t\".\"schema_id\" = \"s\".\"id\""
+ " and \"t\".\"system\" = false"
+ " and \"p\".\"grantor\" = \"g\".\"id\"");
query_end += strlen(query_end);
/* Construct the selection condition query part */
@@ -127,14 +133,14 @@ SQLTablePrivileges_(ODBCStmt *stmt,
isspace((int) TableName[NameLength3 - 1]))
NameLength3--;
if (NameLength2 > 0) {
- sprintf(query_end, " and s.\"name\" = '");
+ sprintf(query_end, " and \"s\".\"name\" = '");
query_end += strlen(query_end);
while (NameLength2-- > 0)
*query_end++ = tolower(*SchemaName++);
*query_end++ = '\'';
}
if (NameLength3 > 0) {
- sprintf(query_end, " and t.\"name\" = '");
+ sprintf(query_end, " and \"t\".\"name\" = '");
query_end += strlen(query_end);
while (NameLength3-- > 0)
*query_end++ = tolower(*TableName++);
@@ -144,7 +150,7 @@ SQLTablePrivileges_(ODBCStmt *stmt,
int escape;
if (NameLength2 > 0) {
escape = 0;
- sprintf(query_end, " and s.\"name\" like '");
+ sprintf(query_end, " and \"s\".\"name\" like '");
query_end += strlen(query_end);
while (NameLength2-- > 0) {
if (*SchemaName == '\\') {
@@ -161,7 +167,7 @@ SQLTablePrivileges_(ODBCStmt *stmt,
}
if (NameLength3 > 0) {
escape = 0;
- sprintf(query_end, " and t.\"name\" like '");
+ sprintf(query_end, " and \"t\".\"name\" like '");
query_end += strlen(query_end);
while (NameLength3-- > 0) {
if (*TableName == '\\') {
@@ -180,8 +186,9 @@ SQLTablePrivileges_(ODBCStmt *stmt,
/* add the ordering */
strcpy(query_end,
- " order by table_cat, table_schem, table_name, privilege,
grantee");
+ " order by \"table_cat\", \"table_schem\", \"table_name\",
\"privilege\", \"grantee\"");
query_end += strlen(query_end);
+ assert((int) (query_end - query) < 1200 + NameLength2 + NameLength3);
/* query the MonetDB data dictionary tables */
rc = SQLExecDirect_(stmt, (SQLCHAR *) query,
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -3068,10 +3068,6 @@ esac
dnl CFLAGS for our code are stricter than what autoconf can cope with.
CFLAGS="$CFLAGS \$(X_CFLAGS)"
-case "$GCC-$CC-$gcc_ver" in
-yes-*clang*-*|yes-*-3.[[4-9]].*|yes-*-[[4-9]].*)
- CFLAGS="$CFLAGS -Wno-declaration-after-statement";;
-esac
dnl bootstrap adds a (long) list of file names inside the
dnl AC_CONFIG_FILES command
diff --git a/sql/server/sql_atom.c b/sql/server/sql_atom.c
--- a/sql/server/sql_atom.c
+++ b/sql/server/sql_atom.c
@@ -314,10 +314,13 @@ atom2string(sql_allocator *sa, atom *a)
char *
atom2sql(atom *a)
{
+ int ec = a->tpe.type->eclass;
char buf[BUFSIZ];
+ if (a->data.vtype == TYPE_str && ec == EC_INTERVAL)
+ ec = EC_STRING;
/* todo handle NULL's early */
- switch (a->tpe.type->eclass) {
+ switch (ec) {
case EC_BIT:
assert( a->data.vtype == TYPE_bit);
if (a->data.val.cval[0])
@@ -325,7 +328,6 @@ atom2sql(atom *a)
return _strdup("false");
case EC_CHAR:
case EC_STRING:
- case EC_INTERVAL:
assert (a->data.vtype == TYPE_str);
if (a->data.val.sval)
sprintf(buf, "'%s'", a->data.val.sval);
@@ -335,6 +337,7 @@ atom2sql(atom *a)
case EC_BLOB:
/* TODO atom to string */
break;
+ case EC_INTERVAL:
case EC_NUM:
switch (a->data.vtype) {
case TYPE_lng:
diff --git a/sql/test/BugTracker-2011/Tests/operands-not-synced.Bug-2346.sql
b/sql/test/BugTracker-2011/Tests/operands-not-synced.Bug-2346.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2011/Tests/operands-not-synced.Bug-2346.sql
@@ -0,0 +1,42 @@
+START TRANSACTION;
+SET SCHEMA "sys";
+CREATE TABLE "sys"."applied_credit" (
+ "directory" VARCHAR(512) NOT NULL,
+ "passed" INTEGER,
+ "allowed" INTEGER NOT NULL,
+ "multiplicity" INTEGER NOT NULL DEFAULT 0,
+ CONSTRAINT "applied_credit_directory_allowed_multiplicity_pkey" PRIMARY
KEY ("directory", "allowed", "multiplicity")
+);
+CREATE TABLE "sys"."success_credit" (
+ "directory" VARCHAR(512) NOT NULL,
+ "passed" INTEGER,
+ "allowed" INTEGER NOT NULL,
+ CONSTRAINT "success_credit_directory_allowed_pkey" PRIMARY KEY
("directory", "allowed")
+);
+COPY 2 RECORDS INTO "sys"."success_credit" FROM stdin USING DELIMITERS
'\t','\n','"';
+"foo" 1270047915 0
+"bar" 1270047915 0
+CREATE TABLE "sys"."success_setting" (
+ "directory" VARCHAR(512) NOT NULL,
+ "rate" INTEGER,
+ "heartbeat" INTEGER,
+ "success_rate" INTEGER,
+ "success_heartbeat" INTEGER,
+ "concurrency" INTEGER,
+ CONSTRAINT "success_setting_directory_pkey" PRIMARY KEY ("directory")
+);
+COPY 2 RECORDS INTO "sys"."success_setting" FROM stdin USING DELIMITERS
'\t','\n','"';
+"foo" 341 300 341 300 5
+"bar" 341 300 341 300 5
+
+INSERT INTO applied_credit (directory, allowed, multiplicity)
+SELECT success_credit.directory,
+ success_credit.allowed,
+ count(applied_credit.directory)
+FROM success_credit
+ LEFT OUTER JOIN applied_credit
+ ON applied_credit.directory = success_credit.directory
+ AND applied_credit.allowed >= success_credit.allowed
+GROUP BY success_credit.directory, success_credit.allowed;
+
+ROLLBACK;
diff --git
a/sql/test/BugTracker-2011/Tests/operands-not-synced.Bug-2346.stable.err
b/sql/test/BugTracker-2011/Tests/operands-not-synced.Bug-2346.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2011/Tests/operands-not-synced.Bug-2346.stable.err
@@ -0,0 +1,48 @@
+stderr of test 'operands-not-synced.Bug-2346` in directory
'test/BugTracker-2011` itself:
+
+
+# 13:48:56 >
+# 13:48:56 > mserver5 --debug=10 --set gdk_nr_threads=0 --set
"gdk_dbfarm=/ufs/sjoerd/Monet-candidate/var/MonetDB" --set mapi_open=true --set
mapi_port=32123 --set monet_prompt= --trace --forcemito --set mal_listing=2
"--dbname=mTests_test_BugTracker-2011" --set mal_listing=0 ; echo ; echo Over..
+# 13:48:56 >
+
+# builtin opt gdk_dbname = demo
+# builtin opt gdk_dbfarm = /ufs/sjoerd/Monet-candidate/var/monetdb5/dbfarm
+# builtin opt gdk_debug = 0
+# builtin opt gdk_alloc_map = no
+# builtin opt gdk_vmtrim = yes
+# builtin opt monet_prompt = >
+# builtin opt monet_daemon = no
+# builtin opt mapi_port = 50000
+# builtin opt mapi_open = false
+# builtin opt mapi_autosense = false
+# builtin opt sql_optimizer = default_pipe
+# builtin opt sql_debug = 0
+# cmdline opt gdk_nr_threads = 0
+# cmdline opt gdk_dbfarm = /ufs/sjoerd/Monet-candidate/var/MonetDB
+# cmdline opt mapi_open = true
+# cmdline opt mapi_port = 32123
+# cmdline opt monet_prompt =
+# cmdline opt mal_listing = 2
+# cmdline opt gdk_dbname = mTests_test_BugTracker-2011
+# cmdline opt mal_listing = 0
+
+# 13:48:57 >
+# 13:48:57 > mclient -lsql -ftest -i -e --host=ottar --port=32123
+# 13:48:57 >
+
+MAPI = monetdb@ottar:32123
+QUERY = INSERT INTO applied_credit (directory, allowed, multiplicity)
+ SELECT success_credit.directory,
+ success_credit.allowed,
+ count(applied_credit.directory)
+ FROM success_credit
+ LEFT OUTER JOIN applied_credit
+ ON applied_credit.directory = success_credit.directory
+ AND applied_credit.allowed >= success_credit.allowed
+ GROUP BY success_credit.directory, success_credit.allowed;
+
+
+# 13:48:57 >
+# 13:48:57 > Done.
+# 13:48:57 >
+
diff --git
a/sql/test/BugTracker-2011/Tests/operands-not-synced.Bug-2346.stable.out
b/sql/test/BugTracker-2011/Tests/operands-not-synced.Bug-2346.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2011/Tests/operands-not-synced.Bug-2346.stable.out
@@ -0,0 +1,97 @@
+stdout of test 'operands-not-synced.Bug-2346` in directory
'test/BugTracker-2011` itself:
+
+
+# 13:48:56 >
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list