[Monetdb-developers] [Monetdb-checkins] clients/src/mapiclient dump.c, , 1.7, 1.8

Niels Nes Niels.Nes at cwi.nl
Sun Aug 12 21:33:58 CEST 2007


On Sun, Aug 12, 2007 at 09:27:36PM +0200, Sjoerd Mullender wrote:
> On 08/12/2007 08:39 PM, Martin Kersten wrote:
> > Update of /cvsroot/monetdb/clients/src/mapiclient
> > In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv25741
> > 
> > Modified Files:
> > 	dump.c 
> > Log Message:
> > Remove duplicate rows. This solves the duplicates seen
> > when typing '\d idxs'.
> 
> Is this the right thing to do?  The problem, it seems to me, is that
> idxs occurs twice in the tables table (select * from tables where name =
> 'idxs'; returns two entries).  Is that correct?

no the double idxs tables are both correct

select * from tables t, schemas s where name = 'idxs' and s.id = t.schema_id;
% sys.t,        sys.t,  sys.t,  sys.t,  sys.t,  sys.t,  sys.t,  sys.t,  sys.s, sys.s,   sys.s,  sys.s # table_name
% id,   name,   schema_id,      query,  type,   system, commit_action,  temporary,      id,     name,   authorization,  owner # name
% int,  varchar,        int,    varchar,        smallint,       boolean,       smallint,        tinyint,        int,    varchar,        int,    int # type
% 4,    4,      4,      1,      1,      5,      1,      1,      4,      3,     1,       1 # length
[ 1049, "idxs", 982,    NULL,   0,      true,   0,      0,      982,    "sys", 2,       3       ]
[ 1109, "idxs", 1083,   NULL,   0,      true,   2,      0,      1083,   "tmp", 2,       3       ]
sql>

So forget the distinct use a correct query (ie only use sys._tables ie no
temp tables (allthough these maybe need to be dumped too (the create statements
that is)).

Niels

> 
> > Index: dump.c
> > ===================================================================
> > RCS file: /cvsroot/monetdb/clients/src/mapiclient/dump.c,v
> > retrieving revision 1.7
> > retrieving revision 1.8
> > diff -u -d -r1.7 -r1.8
> > --- dump.c	10 Aug 2007 11:48:59 -0000	1.7
> > +++ dump.c	12 Aug 2007 18:39:52 -0000	1.8
> > @@ -79,7 +79,7 @@
> >  	fprintf(toConsole, " (\n");
> >  
> >  	snprintf(query, maxquerylen,
> > -		 "SELECT \"c\".\"name\","		/* 0 */
> > +		 "SELECT DISTINCT \"c\".\"name\","		/* 0 */
> >  			"\"c\".\"type\","		/* 1 */
> >  			"\"c\".\"type_digits\","	/* 2 */
> >  			"\"c\".\"type_scale\","		/* 3 */
> > @@ -212,7 +212,7 @@
> >  	}
> >  	mapi_close_handle(hdl);
> >  	snprintf(query, maxquerylen,
> > -		 "SELECT \"kc\".\"column\","		/* 0 */
> > +		 "SELECT DISTINCT \"kc\".\"column\","		/* 0 */
> >  			"\"kc\".\"nr\", "		/* 1 */
> >  			"\"k\".\"name\" "		/* 2 */
> >  		 "FROM \"keycolumns\" \"kc\", "
> > @@ -267,7 +267,7 @@
> >  	mapi_close_handle(hdl);
> >  
> >  	snprintf(query, maxquerylen,
> > -		 "SELECT \"kc\".\"column\","		/* 0 */
> > +		 "SELECT DISTINCT \"kc\".\"column\","		/* 0 */
> >  			"\"kc\".\"nr\", "		/* 1 */
> >  			"\"k\".\"name\" "		/* 2 */
> >  		 "FROM \"keycolumns\" \"kc\", "
> > @@ -325,7 +325,7 @@
> >  	mapi_close_handle(hdl);
> >  
> >  	snprintf(query, maxquerylen,
> > -		 "SELECT \"pkt\".\"name\","		/* 0 */
> > +		 "SELECT DISTINCT \"pkt\".\"name\","		/* 0 */
> >  			"\"pkkc\".\"column\","		/* 1 */
> >  			"\"fkkc\".\"column\","		/* 2 */
> >  			"\"fkkc\".\"nr\","		/* 3 */
> > @@ -432,7 +432,7 @@
> >  	fprintf(toConsole, ");\n");
> >  
> >  	snprintf(query, maxquerylen,
> > -		 "SELECT \"i\".\"name\", "		/* 0 */
> > +		 "SELECT DISTINCT \"i\".\"name\", "		/* 0 */
> >  			"\"k\".\"name\", "		/* 1 */
> >  			"\"kc\".\"nr\", "		/* 2 */
> >  			"\"c\".\"name\" "		/* 3 */
> > @@ -576,13 +576,13 @@
> >  {
> >  	const char *start = "START TRANSACTION";
> >  	const char *end = "COMMIT";
> > -	const char *sequences1 = "SELECT \"name\" FROM \"sequences\"";
> > -	const char *sequences2 = "SELECT seq.\"name\",get_value_for(s.\"name\",seq.\"name\"),\"minvalue\",\"maxvalue\",\"increment\",\"cycle\" FROM \"sequences\" seq, \"schemas\" s WHERE s.id = seq.schema_id";
> > +	const char *sequences1 = "SELECT DISTINCT \"name\" FROM \"sequences\"";
> > +	const char *sequences2 = "SELECT DISTINCT seq.\"name\",get_value_for(s.\"name\",seq.\"name\"),\"minvalue\",\"maxvalue\",\"increment\",\"cycle\" FROM \"sequences\" seq, \"schemas\" s WHERE s.id = seq.schema_id";
> >  	const char *tables = "SELECT \"name\" FROM \"_tables\" WHERE "
> >  		"\"type\" = 0 AND \"system\" = FALSE";
> > -	const char *views = "SELECT \"name\",\"query\" FROM \"_tables\" WHERE "
> > +	const char *views = "SELECT DISTINCT \"name\",\"query\" FROM \"_tables\" WHERE "
> >  		"\"type\" = 1 AND \"system\" = FALSE";
> > -	const char *functions = "SELECT \"func\" FROM \"functions\" WHERE "
> > +	const char *functions = "SELECT DISTINCT \"func\" FROM \"functions\" WHERE "
> >  		"\"sql\" = TRUE";
> >  	MapiHdl hdl;
> >  	int rc = 0;
> > 
> > 
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems?  Stop.
> > Now Search log events and configuration files using AJAX and a browser.
> > Download your FREE copy of Splunk now >>  http://get.splunk.com/
> > _______________________________________________
> > Monetdb-checkins mailing list
> > Monetdb-checkins at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/monetdb-checkins
> 
> 
> -- 
> Sjoerd Mullender
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> _______________________________________________
> Monetdb-developers mailing list
> Monetdb-developers at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/monetdb-developers

-- 

Niels Nes, Centre for Mathematics and Computer Science (CWI)
Kruislaan 413, 1098 SJ Amsterdam, The Netherlands
room C0.02,  phone ++31 20 592-4098, fax ++31 20 592-4312
url: http://www.cwi.nl/~niels   e-mail: Niels.Nes at cwi.nl




More information about the developers-list mailing list