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

Sjoerd Mullender sjoerd at acm.org
Sun Aug 12 21:27:36 CEST 2007


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?

> 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




More information about the developers-list mailing list