Search Postgresql Archives

Re: Invoke diff from plpgsql?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



survivedsushi@xxxxxxxxx (Matthew Peter) writes:
> George Pavlov <gpavlov@xxxxxxxxxxxxxx> 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!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux