Re: [INTERFACES] Re: more odbc patches

Поиск
Список
Период
Сортировка
Искать

Re: [INTERFACES] Re: more odbc patches

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
I have applied the following diff to ODBC to fix the problem, as
Constantin suggested.  Would some ODBC folks please test this and make
sure it works?

> hi, there!
> 
> how about this?
> 
> --- cut here ---
> >From cs@plesk.com Sat Dec 16 15:08:40 2000
> Date: Thu, 14 Dec 2000 17:00:43 +0600 (NOVT)
> From: Constantin S. Svintsoff 
> To: fjoe@iclub.nsu.ru
> Subject: Bug in SQLForeignKeys()
> 
> 
> Query used for checking foreign key triggers
> returns too many results when there're more than one foreign
> key in a table. It happens because only table's oid is used to
> link between pg_trigger with INSERT check and pg_trigger with 
> UPDATE/DELETE check.
> 
> I think there should be enough to add following conditions
> into WHERE clause of that query:
> 	AND	pt.tgconstrname = pg_trigger.tgconstrname
> 	AND	pt.tgconstrname = pg_trigger_1.tgconstrname
> 
> /Constantin
> --- cut here ---
> 
> /fjoe
> 
> 


-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
? config.log
? config.cache
? config.status
? GNUmakefile
? doc/TODO.detail/ProposedTools.doc
? doc/TODO.detail/RDBATools.xls
? src/Makefile.custom
? src/GNUmakefile
? src/Makefile.global
? src/log
? src/crtags
? src/backend/postgres
? src/backend/catalog/global.description
? src/backend/catalog/global.bki
? src/backend/catalog/template1.bki
? src/backend/catalog/template1.description
? src/backend/port/Makefile
? src/bin/initdb/initdb
? src/bin/initlocation/initlocation
? src/bin/ipcclean/ipcclean
? src/bin/pg_config/pg_config
? src/bin/pg_ctl/pg_ctl
? src/bin/pg_dump/pg_dump
? src/bin/pg_dump/pg_restore
? src/bin/pg_dump/pg_dumpall
? src/bin/pg_id/pg_id
? src/bin/pg_passwd/pg_passwd
? src/bin/pgaccess/pgaccess
? src/bin/pgtclsh/Makefile.tkdefs
? src/bin/pgtclsh/Makefile.tcldefs
? src/bin/pgtclsh/pgtclsh
? src/bin/pgtclsh/pgtksh
? src/bin/psql/psql
? src/bin/scripts/createlang
? src/include/config.h
? src/include/stamp-h
? src/interfaces/ecpg/lib/libecpg.so.3.2.0
? src/interfaces/ecpg/preproc/ecpg
? src/interfaces/libpgeasy/libpgeasy.so.2.1
? src/interfaces/libpgtcl/libpgtcl.so.2.1
? src/interfaces/libpq/libpq.so.2.1
? src/interfaces/perl5/blib
? src/interfaces/perl5/Makefile
? src/interfaces/perl5/pm_to_blib
? src/interfaces/perl5/Pg.c
? src/interfaces/perl5/Pg.bs
? src/pl/plperl/blib
? src/pl/plperl/Makefile
? src/pl/plperl/pm_to_blib
? src/pl/plperl/SPI.c
? src/pl/plperl/plperl.bs
? src/pl/plpgsql/src/libplpgsql.so.1.0
? src/pl/tcl/Makefile.tcldefs
Index: src/interfaces/odbc/info.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/odbc/info.c,v
retrieving revision 1.26
diff -c -r1.26 info.c
*** src/interfaces/odbc/info.c	2000/12/11 18:51:25	1.26
--- src/interfaces/odbc/info.c	2001/01/23 20:24:01
***************
*** 2368,2374 ****
  								"AND (pg_proc.proname LIKE '%%upd') "
  								"AND (pg_proc_1.proname LIKE '%%del') "
  								"AND (pg_trigger.tgrelid=pt.tgconstrrelid) "
! 								"AND (pg_trigger_1.tgrelid = pt.tgconstrrelid))", 
  				fk_table_needed);		
  
  		result = SQLExecDirect(htbl_stmt, tables_query, strlen(tables_query));
--- 2368,2376 ----
  								"AND (pg_proc.proname LIKE '%%upd') "
  								"AND (pg_proc_1.proname LIKE '%%del') "
  								"AND (pg_trigger.tgrelid=pt.tgconstrrelid) "
! 								"AND (pg_trigger.tgconstrname=pt.tgconstrname) "
! 								"AND (pg_trigger_1.tgrelid=pt.tgconstrrelid) ", 
! 								"AND (pg_trigger_1.tgconstrname=pt.tgconstrname))", 
  				fk_table_needed);		
  
  		result = SQLExecDirect(htbl_stmt, tables_query, strlen(tables_query));
Index: src/interfaces/odbc/pgtypes.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/odbc/pgtypes.c,v
retrieving revision 1.15
diff -c -r1.15 pgtypes.c
*** src/interfaces/odbc/pgtypes.c	2000/05/27 03:35:14	1.15
--- src/interfaces/odbc/pgtypes.c	2001/01/23 20:24:01
***************
*** 217,223 ****
  	case PG_TYPE_XID:
  	case PG_TYPE_INT4:          return SQL_INTEGER;
  
! 	case PG_TYPE_INT8:			return SQL_BIGINT;
  	case PG_TYPE_NUMERIC:		return SQL_NUMERIC;
  
  	case PG_TYPE_FLOAT4:        return SQL_REAL;
--- 217,225 ----
  	case PG_TYPE_XID:
  	case PG_TYPE_INT4:          return SQL_INTEGER;
  
! 	/* Change this to SQL_BIGINT for ODBC v3 bjm 2001-01-23 */
! 	case PG_TYPE_INT8:			return SQL_CHAR;
! 
  	case PG_TYPE_NUMERIC:		return SQL_NUMERIC;
  
  	case PG_TYPE_FLOAT4:        return SQL_REAL;

Re: Re: [INTERFACES] Re: more odbc patches

От:
Cedar Cox <cedarc@visionforisrael.com>
Дата:

On Tue, 23 Jan 2001, Bruce Momjian wrote:

> I have applied the following diff to ODBC to fix the problem, as
> Constantin suggested.  Would some ODBC folks please test this and make
> sure it works?

I'd be happy to, but I need a little help :)  First of all, do all these
changes I keep seeing have to do with both unix ODBC and windows ODBC?  I
don't have a compiler in windows.  Is anyone posting compiled versions for
people like me to try out?  Lastly, what is it that I'm checking?  I
obviously need to learn something about SQLForeignKeys.  As far as I knew,
anything that had to do with foreign keys was RI.  Simple explanation?, or
link to some reading material?

Thanks,
-Cedar

FAQ