| From: | Peter Eisentraut <peter_e(at)gmx(dot)net> | 
|---|---|
| To: | Jean-Michel POURE <jm(dot)poure(at)freesurf(dot)fr> | 
| Cc: | PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: Diff/Patch integration -> SQL cvs clone | 
| Date: | 2001-11-11 15:40:26 | 
| Message-ID: | Pine.LNX.4.30.0111111607350.647-100000@peter.localdomain | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgadmin-hackers pgsql-hackers | 
Jean-Michel POURE writes:
> Did anyone think of integrating diff/patch within PostgreSQL?
CREATE OR REPLACE FUNCTION diff(text, text) RETURNS text AS '
#!/bin/sh
    echo "$1" > /tmp/$$-one
    echo "$2" > /tmp/$$-two
    diff -c /tmp/$$-one /tmp/$$-two
    echo ""
    rm -f /tmp/$$-one /tmp/$$-two
' LANGUAGE plsh;
peter=> \t\a
peter=> select diff('one\ntwo\nthree\n', 'one\nfive\nthree\n');
*** /tmp/17580-one      Sun Nov 11 16:09:08 2001
--- /tmp/17580-two      Sun Nov 11 16:09:08 2001
***************
*** 1,4 ****
  one
! two
  three
--- 1,4 ----
  one
! five
  three
patch() is left as an exercise. ;-)
-- 
Peter Eisentraut   peter_e(at)gmx(dot)net
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jean-Michel POURE | 2001-11-11 15:41:04 | Re: Diff/Patch integration -> SQL cvs clone | 
| Previous Message | Simeo Reig | 2001-11-10 20:27:51 | Re: Unicode display in VB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2001-11-11 15:40:54 | Re: [COMMITTERS] pgsql/src/backend/postmaster postmaster.c | 
| Previous Message | Peter Eisentraut | 2001-11-11 15:39:30 | Re: Bug #513: union all changes char(3) column definition |