Thread: 7.0 weirdness (maybe solaris?)

7.0 weirdness (maybe solaris?)

From
Jim Mercer
Date:
i've got 7.0RC1 running on a solaris7 box.

i'm running into some problems using the bin scripts.

for example, with destroyuser, we have:
PARGS="-tq $AUTHOPT $PGHOSTOPT $PGPORTOPT"
PSQL="psql $PARGS"
QUERY="select usesuper from pg_user where usename = '$USER'"
ADDUSER=`$PSQL -c "$QUERY" template1`

if [ x$ADDUSER != xt ]
then
    echo "$CMDNAME: $USER cannot delete users."
    exit 1
fi

when i run: "sh -x destroyuser username" i get:
  PSQL=psql -tq
  QUERY=select usesuper from pg_user where usename = 'pgsql'
  + psql -tq -c select usesuper from pg_user where usename = 'pgsql' template1
  ADDUSER= t
  + [ 0 -ne 0 ]
  + [ x t != xt ]
  destroyuser: test: unknown operator t

it appears that the psql client on this machine is prepending a space to the
output of selects.

is this a command line option, a compiler option, a bug?

--
[ Jim Mercer                 jim@reptiles.org              +1 416 506-0654 ]
[          Reptilian Research -- Longer Life through Colder Blood          ]
[  Don't be fooled by cheap Finnish imitations; BSD is the One True Code.  ]

How to connect using pg_connect function from php3 ?

From
"Luiz Antonio"
Date:
Hello list!!!
I´ve installed the postgresql 6.5.2-2cl.i386.rpm, the postgresql-devel, the
postgresql-client and postgresql-lib. After, I created the user postmaster
and the user nobody.
I did a php3 script using the next line:
$conn = pg_connect("localhost", "5432", "", "", "ss"),
but didn´t get to do it work and I had the next warning:
Warning: Unable to connect to PostgresSQL server: connectDB() -- connect()
failed:
Is the postmaster running (with -i) at 'localhost' and accepting connections
on TCP/IP port '5432'? in
/home/httpd/html/postgresql/multi.php3 on line 14

Does anybody know how can I do it?
Do I need to change any name of the last parameters that I am using? Do I
need to add others?

If somebody could help me...thanks!!!

Luiz Antonio


Re: How to connect using pg_connect function from php3 ?

From
Lamar Owen
Date:
Luiz Antonio wrote:
> I´ve installed the postgresql 6.5.2-2cl.i386.rpm, the postgresql-devel, the
> postgresql-client and postgresql-lib. After, I created the user postmaster
[snip]
> Warning: Unable to connect to PostgresSQL server: connectDB() -- connect()
> failed:
> Is the postmaster running (with -i) at 'localhost' and accepting connections
> on TCP/IP port '5432'? in
> /home/httpd/html/postgresql/multi.php3 on line 14

> Does anybody know how can I do it?
> Do I need to change any name of the last parameters that I am using? Do I
> need to add others?

Is the postmaster running with '-i'???? (use ps to check)

These RPMs, are they from Corel Linux or Caldera??
--
Lamar Owen
WGCr Internet Radio
1 Peter 4:11

Re: [HACKERS] 7.0 weirdness (maybe solaris?)

From
Tom Lane
Date:
Jim Mercer <jim@reptiles.org> writes:
> i'm running into some problems using the bin scripts.
> for example, with destroyuser, we have:

destroyuser has been renamed to dropuser in 7.0 (for consistency with
the underlying SQL command).  It looks like you are trying to execute
the old 6.5 script, which indeed expects a different output format than
the current psql generates ...

            regards, tom lane

Re: How to connect using pg_connect function from php3 ?

From
Tom Cook
Date:
On Wed, 26 Apr 2000, Luiz Antonio wrote:

> Hello list!!!
> I�ve installed the postgresql 6.5.2-2cl.i386.rpm, the postgresql-devel, the
> postgresql-client and postgresql-lib. After, I created the user postmaster
> and the user nobody.
> I did a php3 script using the next line:
> $conn = pg_connect("localhost", "5432", "", "", "ss"),
> but didn�t get to do it work and I had the next warning:
> Warning: Unable to connect to PostgresSQL server: connectDB() -- connect()
> failed:
> Is the postmaster running (with -i) at 'localhost' and accepting connections
> on TCP/IP port '5432'? in
> /home/httpd/html/postgresql/multi.php3 on line 14

Have you checked the suggestion it makes? You need to run postmaster with
the -i flag so that it is listening on TCP/IP ports, not only UDP. Also
make sure that you have the correct port number.

> Does anybody know how can I do it?
> Do I need to change any name of the last parameters that I am using? Do I
> need to add others?
>
> If somebody could help me...thanks!!!

HTH!
--
Tom Cook - Software Engineer

"Never criticize a man until you've walked a mile in his shoes; that way,
when you criticize him, you're a mile away and have his shoes."
    - Unknown

LISAcorp - www.lisa.com.au

--------------------------------------------------
38 Greenhill Rd.          Level 3, 228 Pitt Street
Wayville, SA, 5034        Sydney, NSW, 2000

Phone:   +61 8 8272 1555  Phone:   +61 2 9283 0877
Fax:     +61 8 8271 1199  Fax:     +61 2 9283 0866
--------------------------------------------------


Re: How to connect using pg_connect function from php3 ?

From
Tatsuo Ishii
Date:
> Hello list!!!
> I´ve installed the postgresql 6.5.2-2cl.i386.rpm, the postgresql-devel, the
> postgresql-client and postgresql-lib. After, I created the user postmaster
> and the user nobody.
> I did a php3 script using the next line:
> $conn = pg_connect("localhost", "5432", "", "", "ss"),
> but didn´t get to do it work and I had the next warning:
> Warning: Unable to connect to PostgresSQL server: connectDB() -- connect()
> failed:
> Is the postmaster running (with -i) at 'localhost' and accepting connections
> on TCP/IP port '5432'? in
> /home/httpd/html/postgresql/multi.php3 on line 14
>
> Does anybody know how can I do it?
> Do I need to change any name of the last parameters that I am using? Do I
> need to add others?
>
> If somebody could help me...thanks!!!

You need to tweak pg_hba.conf. However if you just want to connect
local PostgreSQL server at 5432 port with the Unix domain socket,

$conn = pg_connect("", "", "ss");

would be enough, for the rather newer PHP (you didn't tell what
version of PHP you are using, though).
--
Tatsuo Ishii