Re: Solution for bug #899

From: Laurent FAILLIE <l_faillie(at)yahoo(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Solution for bug #899
Date: 2003-03-25 14:03:26
Message-ID: 20030325140326.83471.qmail@web13502.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2003-03-25 14:42:18 Re: Can't connect to my postgresql
Previous Message Daniel Rubio 2003-03-25 14:03:12 Can't connect to my postgresql