Re: Diff/Patch integration -> SQL cvs clone

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: Diff/Patch integration -> SQL cvs clone
Дата
Msg-id Pine.LNX.4.30.0111111607350.647-100000@peter.localdomain
обсуждение исходный текст
Ответ на Diff/Patch integration -> SQL cvs clone  (Jean-Michel POURE <jm.poure@freesurf.fr>)
Ответы Re: Diff/Patch integration -> SQL cvs clone  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список 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@gmx.net



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: compiling libpq++ on Solaris with Sun SPRO6U2 (fixed
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [BUGS] Bug #513: union all changes char(3) column definition