Add pg_catalog to pltcl code

Started by Greg Sabino Mullaneabout 23 years ago2 messagespatches
Jump to latest
#1Greg Sabino Mullane
greg@turnstep.com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message

Small changes to use the absolute path to system catalogs:

--
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200305051153

? test/test.out
Index: pltcl.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/pl/tcl/pltcl.c,v
retrieving revision 1.69
diff -c -r1.69 pltcl.c
*** pltcl.c	2003/02/06 17:02:11	1.69
--- pltcl.c	2003/05/05 15:52:06
***************
*** 309,315 ****
  	/************************************************************
  	 * Check if table pltcl_modules exists
  	 ************************************************************/
! 	spi_rc = SPI_exec("select 1 from pg_class "
  					  "where relname = 'pltcl_modules'", 1);
  	SPI_freetuptable(SPI_tuptable);
  	if (spi_rc != SPI_OK_SELECT)
--- 309,315 ----
  	/************************************************************
  	 * Check if table pltcl_modules exists
  	 ************************************************************/
! 	spi_rc = SPI_exec("select 1 from pg_catalog.pg_class "
  					  "where relname = 'pltcl_modules'", 1);
  	SPI_freetuptable(SPI_tuptable);
  	if (spi_rc != SPI_OK_SELECT)
Index: modules/pltcl_loadmod.in
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/pl/tcl/modules/pltcl_loadmod.in,v
retrieving revision 1.2
diff -c -r1.2 pltcl_loadmod.in
*** modules/pltcl_loadmod.in	2001/05/11 23:38:06	1.2
--- modules/pltcl_loadmod.in	2003/05/05 15:52:06
***************
*** 84,90 ****
      set found 0
      pg_select $conn "select C.relname, A.attname, A.attnum, T.typname 	\
!     		from pg_class C, pg_attribute A, pg_type T		\
  		where C.relname = '$tabname'				\
  		  and A.attrelid = C.oid				\
  		  and A.attnum > 0					\
--- 84,90 ----
      set found 0
      pg_select $conn "select C.relname, A.attname, A.attnum, T.typname 	\
!     		from pg_catalog.pg_class C, pg_catalog.pg_attribute A, pg_catalog.pg_type T		\
  		where C.relname = '$tabname'				\
  		  and A.attrelid = C.oid				\
  		  and A.attnum > 0					\
Index: test/test_setup.sql
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/pl/tcl/test/test_setup.sql,v
retrieving revision 1.5
diff -c -r1.5 test_setup.sql
*** test/test_setup.sql	2002/10/19 22:01:45	1.5
--- test/test_setup.sql	2003/05/05 15:52:06
***************
*** 319,325 ****
  	    # Lookup the fields type in pg_attribute
  	    #
  	    set n [spi_exec "select T.typname			\\
! 	        from pg_type T, pg_attribute A, pg_class C	\\
  		where C.relname  = ''[quote $keyrel]''		\\
  		  and C.oid      = A.attrelid			\\
  		  and A.attname  = ''[quote $key]''		\\
--- 319,325 ----
  	    # Lookup the fields type in pg_attribute
  	    #
  	    set n [spi_exec "select T.typname			\\
! 	        from pg_catlog.pg_type T, pg_catalog.pg_attribute A, pg_catalog.pg_class C	\\
  		where C.relname  = ''[quote $keyrel]''		\\
  		  and C.oid      = A.attrelid			\\
  		  and A.attname  = ''[quote $key]''		\\
***************
*** 343,349 ****
  	#
  	# Lookup and remember the table name for later error messages
  	#
! 	spi_exec "select relname from pg_class			\\
  		where oid = ''$TG_relid''::oid"
  	set GD($planrel) $relname
      }
--- 343,349 ----
  	#
  	# Lookup and remember the table name for later error messages
  	#
! 	spi_exec "select relname from pg_catalog.pg_class			\\
  		where oid = ''$TG_relid''::oid"
  	set GD($planrel) $relname
      }

-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html

iD8DBQE+tokmvJuQZxSWSsgRAuTWAKC3mY3NkCXE16M/3Qj9ON/j9K57SACg6Zg9
jN5sYcyajS5pRyIaOx8Mrt0=
=NQgU
-----END PGP SIGNATURE-----

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Greg Sabino Mullane (#1)
Re: Add pg_catalog to pltcl code

"Greg Sabino Mullane" <greg@turnstep.com> writes:

Small changes to use the absolute path to system catalogs:

Applied (with typo correction).

regards, tom lane