Обсуждение: Invoke diff from plpgsql?

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

Invoke diff from plpgsql?

От
Matthew Peter
Дата:
Wondering how to invoke a application like diff from plpgsql? Thanks!


Blab-away for as little as 1¢/min. Make PC-to-Phone Calls using Yahoo! Messenger with Voice.

Re: Invoke diff from plpgsql?

От
"Greg Sabino Mullane"
Дата:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> Wondering how to invoke a application like diff from plpgsql? Thanks!

Pl/Pgsql cannot execute system commands. For that, you will need one
of the other Pl languages, running in "untrusted" mode. Here are
some from the manual:

http://www.postgresql.org/docs/current/static/pltcl.html
http://www.postgresql.org/docs/current/static/plperl.html
http://www.postgresql.org/docs/current/static/plpython.html

- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200605262300
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8

-----BEGIN PGP SIGNATURE-----

iD8DBQFEd8DMvJuQZxSWSsgRAo5qAJwNa+Nvxy8b094l1pYEyUVKB89vHwCgywXO
7mpUYWPeQ0q8qXpM/f/8g2s=
=0Evq
-----END PGP SIGNATURE-----



Re: Invoke diff from plpgsql?

От
"Joshua D. Drake"
Дата:
Matthew Peter wrote:
> Wondering how to invoke a application like diff from plpgsql? Thanks!

You can't.

But you couuld from plPerl or plPython

>
> ------------------------------------------------------------------------
> Blab-away for as little as 1¢/min. Make PC-to-Phone Calls
> <http://us.rd.yahoo.com/mail_us/taglines/postman2/*http://us.rd.yahoo.com/evt=39663/*http://voice.yahoo.com>
> using Yahoo! Messenger with Voice.


--

    === The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
    Providing the most comprehensive  PostgreSQL solutions since 1997
              http://www.commandprompt.com/



Re: Invoke diff from plpgsql?

От
"George Pavlov"
Дата:
> Wondering how to invoke a application like diff from plpgsql? Thanks!

And don't forget that you are working with a database. Most diff-ing
uses can probably be handled by constructs like EXCEPT and INTERSECT to
say nothing of OUTER JOINs. Also, IS DISTINCT FROM is your friend if you
want a comparison that treats NULLs as "normal" data values.

db_user_namespace

От
Rafal Pietrak
Дата:
Hi All,

Having the new (as of rel 8.xx) ROLE system; whould it be a problem to
implement a:

    GRANT/REVOKE CONNECT ON "database" TO/FROM "role" | PUBLIC;

instead of current cludge of "db_user_namespace"?


--
-R

Re: db_user_namespace

От
Martijn van Oosterhout
Дата:
On Sat, May 27, 2006 at 01:39:18PM +0200, Rafal Pietrak wrote:
> Hi All,
>
> Having the new (as of rel 8.xx) ROLE system; whould it be a problem to
> implement a:
>
>     GRANT/REVOKE CONNECT ON "database" TO/FROM "role" | PUBLIC;
>
> instead of current cludge of "db_user_namespace"?

A patch has already been submitted for this. I don't know if it's been
included yet.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения

Re: Invoke diff from plpgsql?

От
Matthew Peter
Дата:
George Pavlov <gpavlov@mynewplace.com> wrote:
> Wondering how to invoke a application like diff from plpgsql? Thanks!

And don't forget that you are working with a database. Most diff-ing
uses can probably be handled by constructs like EXCEPT and INTERSECT to
say nothing of OUTER JOINs. Also, IS DISTINCT FROM is your friend if you
want a comparison that treats NULLs as "normal" data values.
Thanks for the replies. What I wanted to do was just track the changes to a column... like svn does so I can get a history and incremental changes of a article per user handled by a trigger. Saving the output from diff seemed simple enough rather than the entire article.

Is there a contrib modules or otherwise to enable tracking changes like that in plpgsql?


Feel free to call! Free PC-to-PC calls. Low rates on PC-to-Phone. Get Yahoo! Messenger with Voice

Re: Invoke diff from plpgsql?

От
Chris Browne
Дата:
survivedsushi@yahoo.com (Matthew Peter) writes:
> George Pavlov <gpavlov@mynewplace.com> wrote:
>
>           > Wondering how to invoke a application like diff from plpgsql? Thanks!
>
>      And don't forget that you are working with a database. Most diff-ing
>      uses can probably be handled by constructs like EXCEPT and INTERSECT to
>      say nothing of OUTER JOINs. Also, IS DISTINCT FROM is your friend if you
>      want a comparison that treats NULLs as "normal" data values.
>
>
>
> Thanks for the replies. What I wanted to do was just track the
> changes to a column... like svn does so I can get a history and
> incremental changes of a article per user handled by a
> trigger. Saving the output from diff seemed simple enough rather
> than the entire article.  Is there a contrib modules or otherwise to
> enable tracking changes like that in plpgsql?

I suppose it would be *plausible* to store sets of patches in a
database; the fact that updates could be handled within transactions
has some appeal.

Unfortunately, building in a "diff" would be somewhat challenging:

- on the one hand, "stealing code" from C implementations is something
of a stability/security risk;

- on the other hand, "diff" tends to be somewhat complex, such that
reimplementing in one of the pl/languages (pl/pgsql, pl/perl,
pl/python, pl/tcl) is likely to fall prey to "recreating bugs."  Mind
you, in languages where strings are "first class" objects, it's
probably a lot easier to implement diff correctly than it is in C...

- I'd ask the question of whether or not it is *actually* worthwhile.
Columns more than 8K in size (and this seems quite likely, for
articles) are compressed in TOAST entries in the database, so you may
already be getting savings you weren't aware of...
--
(format nil "~S@~S" "cbbrowne" "ntlug.org")
http://cbbrowne.com/info/x.html
Microsoft Outlook: Deploying Viruses Has Never Been This Easy!