Return-Path: owner-postman 
Delivery-Date: Tue, 10 May 94 14:34:54 -0700
Return-Path: owner-postman
Received: from localhost (localhost [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with SMTP id IAA07734 for postgres-redist; Tue, 10 May 1994 08:51:00 -0700
Resent-From: POSTGRES mailing list <postman@postgres.Berkeley.EDU>
Resent-Message-Id: <199405101551.IAA07734@nobozo.CS.Berkeley.EDU>
X-Authentication-Warning: nobozo.CS.Berkeley.EDU: Host localhost didn't use HELO protocol
Sender: owner-postman@postgres.Berkeley.EDU
X-Return-Path: owner-postman
Received: from nlm.nih.gov (lhc.nlm.nih.gov [130.14.1.128]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with SMTP id IAA07724 for <postgres@postgres.Berkeley.EDU>; Tue, 10 May 1994 08:50:58 -0700
Received: from hume.csb (hume.nlm.nih.gov) by nlm.nih.gov (4.1/SMI-4.0)
	id AA18586; Tue, 10 May 94 11:50:56 EDT
Received: by hume.csb (4.1/SMI-4.1)
	id AA20018; Tue, 10 May 94 11:55:33 EDT
Date: Tue, 10 May 94 11:55:33 EDT
From: suresh@nlm.nih.gov (Suresh Srinivasan)
Message-Id: <9405101555.AA20018@hume.csb>
To: postgres@postgres.Berkeley.EDU
Subject: Re: Mosaic and libpq
Resent-To: postgres-redist@postgres.Berkeley.EDU
Resent-Date: Tue, 10 May 94 08:50:59 -0700
Resent-XMts: smtp



----- Begin Included Message -----

 I'm having problems with the libpq call PQexec.

 I'm almost positive the problem stems from trying to integrate my
 postgres and a mosaic form server. If anyone knows what I'm talking about,
 please help. Here's some more details.

...

----- End Included Message -----


I'm using just such a beast - an unmodified NCSA httpd calling
an application written in C (that uses Postgres) via CGI.

One of the gotchas in this regard is that the CGI program
has to run as user "postgres", or whoever has access to
the databases in question.  Remember the http daemon generally
runs as nobody.  So the first thing to do in the CGI program
is to putenv("USER=postgres"), or at least just before
accessing the database.

Another is that the output of the program must have the
correct MIME tag in the first line, i.e., "Content-type:
text/html" (in my case) followed by two newlines.

I have some perl scripts that will emulate the environment
that the CGI program is running in.  These were valuable in
being able to debug the application.  Send me mail if
you're interested.

--Suresh (suresh@nlm.nih.gov)


===============================================================================
    To add/remove yourself from the POSTGRES mailing list: send mail with 
    the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU"

    If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
    a human will deal with it.  DO NOT post to the "postgres" mailing list.
===============================================================================

