Re: [DOCS] [PATCHES] Summary table trigger example race condition

2006-01-12 Thread Alvaro Herrera
Mark Kirkwood wrote:

> Yes it would - I usually build the SGML -> HTML, then cut the code out 
> of a browser session to test - the pain is waiting for the docs to build.

FWIW, what I do is to build a cut-down version of postgres.sgml to
include only the file you want to check.  I think there is a suggestion
somewhere telling you to add a DTD line to compile only that file.


---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [DOCS] [PATCHES] Summary table trigger example race condition

2006-01-12 Thread Peter Eisentraut
Jim C. Nasby wrote:
> DOH! It would be good if doc/src had a better mechanism for handling
> code; one that would allow for writing the code natively (so you
> don't have to worry about translating < into < and > into >)
> and for unit testing the different pieces of code.



-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


Re: [DOCS] [PATCHES] Summary table trigger example race condition

2006-01-12 Thread Jim C. Nasby
On Thu, Jan 12, 2006 at 09:58:54PM +0100, Peter Eisentraut wrote:
> Jim C. Nasby wrote:
> > DOH! It would be good if doc/src had a better mechanism for handling
> > code; one that would allow for writing the code natively (so you
> > don't have to worry about translating < into < and > into >)
> > and for unit testing the different pieces of code.
> 
> 

While that certainly takes care of < and >, it doesn't do anything for
allowing testing of code examples.

If instead we put code snippets into seperate files that could actually
be run via psql, we could actually test the code examples that we're
including in the docs. We could also easily capture the output from that
code to include in the docs.

If things go well, I'll soon be working on a database book, and my plan
is to use this technique to (hopefully) speed up production. If that
happens I'll post the code here for folks to look at.
-- 
Jim C. Nasby, Sr. Engineering Consultant  [EMAIL PROTECTED]
Pervasive Software  http://pervasive.comwork: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf   cell: 512-569-9461

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


[DOCS] Example for UPDATE FROM with correllation

2006-01-12 Thread David Fetter
Folks,

Please find enclosed a doc patch that adds an example of a correllated
UPDATE.

Cheers,
D
-- 
David Fetter [EMAIL PROTECTED] http://fetter.org/
phone: +1 415 235 3778

Remember to vote!
Index: doc/src/sgml/ref/update.sgml
===
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/update.sgml,v
retrieving revision 1.33
diff -c -r1.33 update.sgml
*** doc/src/sgml/ref/update.sgml12 Oct 2005 23:19:22 -  1.33
--- doc/src/sgml/ref/update.sgml12 Jan 2006 22:04:40 -
***
*** 213,218 
--- 213,230 
(SELECT sales_person FROM accounts WHERE name = 'Acme Corporation');
  
  
+Now that all the papers are signed, update the most recently closed
+ deal of the travelling salesperson who closed the Rocket Powered
+ Skates deal with the Acme Corporation.
+ 
+ UPDATE employees SET last_closed_deal = deal.id
+ FROM accounts JOIN deals ON (account.id = deal.account_id)
+ WHERE deal.employee_id = employees.id
+ AND deal.name = 'Rocket Powered Skates'
+ AND accounts.name = 'Acme Corporation'
+ ORDER BY deal.signed_date DESC LIMIT 1;
+ 
+ 
 Attempt to insert a new stock item along with the quantity of stock. If
 the item already exists, instead update the stock count of the existing
 item. To do this without failing the entire transaction, use savepoints.

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster