Skip site navigation (1) Skip section navigation (2)

Re: Solution for bug #899

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Laurent FAILLIE <l_faillie(at)yahoo(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Solution for bug #899
Date: 2003-03-25 15:10:02
Message-ID: 200303251510.h2PFA3N09409@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Your patch has been added to the PostgreSQL unapplied patches list at:

	http://momjian.postgresql.org/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------


Laurent FAILLIE wrote:
> Hello Bruce,
> 
> there is a contextual diff of my patch w/ the current
> (I hope) snapshot of postgresql.
> 
> I test it on my own database, but I found another bug
> w/ SEQUENCE this time. I have created a new ticket,
> #918 for this as it's totaly a separate problem.
> 
> Bye
> 
> Laurent
> 
> ------
> 
> *** pg_dump.c.org	Tue Mar 25 10:33:01 2003
> --- pg_dump.c	Tue Mar 25 11:42:17 2003
> ***************
> *** 605,610 ****
> --- 605,618 ----
>   
>   	/* Now sort the output nicely */
>   	SortTocByOID(g_fout);
> + 
> + 		/*
> + 		 * Procedural languages have to be declared just
> after
> + 		 * database and schema creation, before they are
> used.
> + 		 */
> + 	MoveToStart(g_fout, "ACL LANGUAGE");
> + 	MoveToStart(g_fout, "PROCEDURAL LANGUAGE");
> + 	MoveToStart(g_fout, "FUNC PROCEDURAL LANGUAGE");
>   	MoveToStart(g_fout, "SCHEMA");
>   	MoveToStart(g_fout, "DATABASE");
>   	MoveToEnd(g_fout, "TABLE DATA");
> ***************
> *** 3626,3632 ****
>   		{
>   			char	   *tmp = strdup(fmtId(lanname));
>   
> ! 			dumpACL(fout, "LANGUAGE", tmp, lanname,
>   					finfo[fidx].pronamespace->nspname,
>   					NULL, lanacl, lanoid);
>   			free(tmp);
> --- 3634,3640 ----
>   		{
>   			char	   *tmp = strdup(fmtId(lanname));
>   
> ! 			dumpACL(fout, "ACL LANGUAGE", tmp, lanname,
>   					finfo[fidx].pronamespace->nspname,
>   					NULL, lanacl, lanoid);
>   			free(tmp);
> ***************
> *** 3732,3737 ****
> --- 3740,3746 ----
>   	char	   *prosecdef;
>   	char	   *lanname;
>   	char	   *rettypename;
> + 	char       *funcproclang;	/* Boolean : is this
> function a PLang handler ? */
>   
>   	if (finfo->dumped)
>   		goto done;
> ***************
> *** 3747,3753 ****
>   		appendPQExpBuffer(query,
>   						  "SELECT proretset, prosrc, probin, "
>   						  "provolatile, proisstrict, prosecdef, "
> ! 						  "(SELECT lanname FROM pg_catalog.pg_language
> WHERE oid = prolang) as lanname "
>   						  "FROM pg_catalog.pg_proc "
>   						  "WHERE oid = '%s'::pg_catalog.oid",
>   						  finfo->oid);
> --- 3756,3763 ----
>   		appendPQExpBuffer(query,
>   						  "SELECT proretset, prosrc, probin, "
>   						  "provolatile, proisstrict, prosecdef, "
> ! 						  "(SELECT lanname FROM pg_catalog.pg_language
> WHERE oid = prolang) as lanname, "
> ! 						  "exists (SELECT 'x' FROM
> pg_catalog.pg_language WHERE lanplcallfoid =
> pg_catalog.pg_proc.oid) as funcproclang "
>   						  "FROM pg_catalog.pg_proc "
>   						  "WHERE oid = '%s'::pg_catalog.oid",
>   						  finfo->oid);
> ***************
> *** 3759,3765 ****
>   		 "case when proiscachable then 'i' else 'v' end as
> provolatile, "
>   						  "proisstrict, "
>   						  "'f'::boolean as prosecdef, "
> ! 						  "(SELECT lanname FROM pg_language WHERE oid
> = prolang) as lanname "
>   						  "FROM pg_proc "
>   						  "WHERE oid = '%s'::oid",
>   						  finfo->oid);
> --- 3769,3776 ----
>   		 "case when proiscachable then 'i' else 'v' end as
> provolatile, "
>   						  "proisstrict, "
>   						  "'f'::boolean as prosecdef, "
> ! 						  "(SELECT lanname FROM pg_language WHERE oid
> = prolang) as lanname, "
> ! 						  "exists (SELECT 'x' FROM pg_language WHERE
> lanplcallfoid = pg_proc.oid) as funcproclang "
>   						  "FROM pg_proc "
>   						  "WHERE oid = '%s'::oid",
>   						  finfo->oid);
> ***************
> *** 3771,3777 ****
>   		 "case when proiscachable then 'i' else 'v' end as
> provolatile, "
>   						  "'f'::boolean as proisstrict, "
>   						  "'f'::boolean as prosecdef, "
> ! 						  "(SELECT lanname FROM pg_language WHERE oid
> = prolang) as lanname "
>   						  "FROM pg_proc "
>   						  "WHERE oid = '%s'::oid",
>   						  finfo->oid);
> --- 3782,3789 ----
>   		 "case when proiscachable then 'i' else 'v' end as
> provolatile, "
>   						  "'f'::boolean as proisstrict, "
>   						  "'f'::boolean as prosecdef, "
> ! 						  "(SELECT lanname FROM pg_language WHERE oid
> = prolang) as lanname, "
> ! 						  "exists (SELECT 'x' FROM pg_language WHERE
> lanplcallfoid = pg_proc.oid) as funcproclang "
>   						  "FROM pg_proc "
>   						  "WHERE oid = '%s'::oid",
>   						  finfo->oid);
> ***************
> *** 3802,3807 ****
> --- 3814,3820 ----
>   	proisstrict = PQgetvalue(res, 0, PQfnumber(res,
> "proisstrict"));
>   	prosecdef = PQgetvalue(res, 0, PQfnumber(res,
> "prosecdef"));
>   	lanname = PQgetvalue(res, 0, PQfnumber(res,
> "lanname"));
> + 	funcproclang = PQgetvalue(res, 0, PQfnumber(res,
> "funcproclang"));
>   
>   	/*
>   	 * See backend/commands/define.c for details of how
> the 'AS' clause is
> ***************
> *** 3872,3878 ****
>   
>   	ArchiveEntry(fout, finfo->oid, funcsig_tag,
>   				 finfo->pronamespace->nspname,
> ! 				 finfo->usename, "FUNCTION", NULL,
>   				 q->data, delqry->data,
>   				 NULL, NULL, NULL);
>   
> --- 3885,3891 ----
>   
>   	ArchiveEntry(fout, finfo->oid, funcsig_tag,
>   				 finfo->pronamespace->nspname,
> ! 				 finfo->usename,
> strcmp(funcproclang,"t")?"FUNCTION":"FUNC PROCEDURAL
> LANGUAGE", NULL,
>   				 q->data, delqry->data,
>   				 NULL, NULL, NULL);
>   
> ***************
> *** 5024,5034 ****
>   	PQExpBuffer sql, grantee, grantor, privs, privswgo;
>   	bool		found_owner_privs = false;
>   
>   	if (strlen(acls) == 0)
>   		return;					/* object has default permissions */
>   
>   #define MKENTRY(grantor, command) \
> ! 	ArchiveEntry(fout, objoid, tag, nspname, grantor ?
> grantor : "", "ACL", NULL, command, "", NULL, NULL,
> NULL)
>   
>   	sql = createPQExpBuffer();
>   	grantee = createPQExpBuffer();
> --- 5037,5057 ----
>   	PQExpBuffer sql, grantee, grantor, privs, privswgo;
>   	bool		found_owner_privs = false;
>   
> + 		/* acl_lang is a flag only true if we are dumping
> language's ACL,
> + 		 * so we can set 'type' to a value that is
> suitable to build
> + 		 * SQL requests as for other types.
> + 		 */
> + 	bool       acl_lang = false;
> + 	if(!strcmp(type,"ACL LANGUAGE")){
> + 		type = "LANGUAGE";
> + 		acl_lang = true;
> + 	}
> + 
>   	if (strlen(acls) == 0)
>   		return;					/* object has default permissions */
>   
>   #define MKENTRY(grantor, command) \
> ! 	ArchiveEntry(fout, objoid, tag, nspname, grantor ?
> grantor : "", acl_lang ? "ACL LANGUAGE" : "ACL" ,
> NULL, command, "", NULL, NULL, NULL)
>   
>   	sql = createPQExpBuffer();
>   	grantee = createPQExpBuffer();
> 
> 
> =====
> The misspelling master is on the Web.
>    _________	100 % Dictionnary Free !
>   /        /(
>  /  Dico  / /	Pleins d'autres fautes sur
> /________/ /	http://go.to/destroyedlolo
> (#######( /	http://destroyedlolo.homeunix.org:8080
> Quoi, des fautes d'orthographe! Pas possible ;-D.
> 
> ___________________________________________________________
> Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en fran?ais !
> Yahoo! Mail : http://fr.mail.yahoo.com
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073


In response to

pgsql-bugs by date

Next:From: KroKDate: 2003-03-25 15:13:25
Subject: Backend crashe with signal 11 wher restoring big database.
Previous:From: Bruce MomjianDate: 2003-03-25 15:08:54
Subject: Re: Bug #918: pg_dump problem w/ SEQUENCE

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group