Thread: Problems compiling 7.1 with TCL support on Solaris 7

Problems compiling 7.1 with TCL support on Solaris 7

From
Andy Howarth
Date:
I did a first installation without TCL support, that compiled, installed
and appeared to work ok.

However when I try to add TCL support, the following happens during
'make':

[snipped]
.
.
.
make[3]: Entering directory
`/export/home/andy/postgresql-7.1/src/pl/tcl'
/bin/sh mkMakefile.tcldefs.sh '/usr/local/lib/tclConfig.sh'
'Makefile.tcldefs'
make[3]: Leaving directory `/export/home/andy/postgresql-7.1/src/pl/tcl'
make[3]: Entering directory
`/export/home/andy/postgresql-7.1/src/pl/tcl'
cc -O -KPIC -I../../../src/include  -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1
-DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRSTR=1 -DHAVE_STRTOL=1
-DHAVE_TMPNAM=1 -DHAVE_WAITPID=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1
-DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1
-DHAVE_TZNAME=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_ST_BLKSIZE=1
-DSTDC_HEADERS=1 -DNO_UNION_WAIT=1 -DNEED_MATHERR=1 -DRETSIGTYPE=void
-DHAVE_SIGNED_CHAR=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_FILIO_H=1   -c -o
pltcl.o pltcl.c
make[3]: cc: Command not found
make[3]: *** [pltcl.o] Error 127
make[3]: Leaving directory `/export/home/andy/postgresql-7.1/src/pl/tcl'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/export/home/andy/postgresql-7.1/src/pl'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/export/home/andy/postgresql-7.1/src'
make: *** [all] Error 2

Er, WHAT? > make[3]: cc: Command not found

So, suddenly we want cc. Hmm, ok novice brute force to make it use gcc:

make[3]: Entering directory
`/export/home/andy/postgresql-7.1/src/pl/tcl'
cc -O -KPIC -I../../../src/include  -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1
-DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRSTR=1 -DHAVE_STRTOL=1
-DHAVE_TMPNAM=1 -DHAVE_WAITPID=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1
-DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1
-DHAVE_TZNAME=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_ST_BLKSIZE=1
-DSTDC_HEADERS=1 -DNO_UNION_WAIT=1 -DNEED_MATHERR=1 -DRETSIGTYPE=void
-DHAVE_SIGNED_CHAR=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_FILIO_H=1   -c -o
pltcl.o pltcl.c
cc: unrecognized option `-KPIC'
/usr/ccs/bin/ld -G -z text -o pltcl.so pltcl.o -L/usr/local/lib -ltcl8.2
-ldl  -lsocket -lnsl -lm -lc
Text relocation remains                         referenced
    against symbol                  offset      in file
<unknown>                           0x4         pltcl.o
<unknown>                           0x8         pltcl.o
<unknown>                           0xbc0       pltcl.o
<unknown>                           0x20        pltcl.o
<unknown>                           0x2c        pltcl.o
<unknown>                           0xbd4       pltcl.o
<unknown>                           0x27ec      pltcl.o
<unknown>                           0x980       pltcl.o
<unknown>                           0x40        pltcl.o
.
[snipped loads of this]
.
<unknown>                           0x2f20      pltcl.o
<unknown>                           0x217c      pltcl.o
<unknown>                           0x2180      pltcl.o
ld: fatal: relocations remain against allocatable but non-writable
sections
make[3]: *** [pltcl.so] Error 1
make[3]: Leaving directory `/export/home/andy/postgresql-7.1/src/pl/tcl'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/export/home/andy/postgresql-7.1/src/pl'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/export/home/andy/postgresql-7.1/src'
make: *** [all] Error 2

Does anybody know why this happens? (We have TCL/Tk version 8.2
installed)

Thanks,
Andy.

psql with PHP question

From
Jason
Date:
Hi, I want to try  and optimize my calls to postgreSQL from PHP.  If
I only need one field from a select statement, what should I use?  I am
currently using:
$q = pg_Exec("SELECT id FROM article WHERE id=(SELECT MAX(id)
FROM article)");
$maxid = pg_fetch_array($q, 0);
echo "The highest id is ". $maxid[0];
What can I use besides an array to get a single value? In general, using
a single variable always saves more memory than using an array?  Thank
you.
Jason


Re: psql with PHP question

From
Chris Ryan
Date:
Jason,

    Look into the pg_result() function. You would use it something like
this:

$q = pg_Exec("SELECT id FROM article WHERE id=(SELECT MAX(id) FROM
article)");
$maxid = pg_result($q,0,0); # pg_result($result,$row,$column_num)
echo "The highest id is ". $maxid[0];

    Hope this helps.

Chris Ryan
chris@greatbridge.com

Jason wrote:
>
> Hi, I want to try  and optimize my calls to postgreSQL from PHP.  If
> I only need one field from a select statement, what should I use?  I am
> currently using:
> $q = pg_Exec("SELECT id FROM article WHERE id=(SELECT MAX(id)
> FROM article)");
> $maxid = pg_fetch_array($q, 0);
> echo "The highest id is ". $maxid[0];
> What can I use besides an array to get a single value? In general, using
> a single variable always saves more memory than using an array?  Thank
> you.
> Jason
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl




Re: Problems compiling 7.1 with TCL support on Solaris 7

From
Tom Lane
Date:
Andy Howarth <andy@is3-design.com> writes:
> However when I try to add TCL support, the following happens during
> 'make':

> make[3]: Entering directory
> `/export/home/andy/postgresql-7.1/src/pl/tcl'
> cc -O -KPIC -I../../../src/include  -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1
> -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRSTR=1 -DHAVE_STRTOL=1
> -DHAVE_TMPNAM=1 -DHAVE_WAITPID=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1
> -DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1
> -DHAVE_TZNAME=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_ST_BLKSIZE=1
> -DSTDC_HEADERS=1 -DNO_UNION_WAIT=1 -DNEED_MATHERR=1 -DRETSIGTYPE=void
> -DHAVE_SIGNED_CHAR=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_FILIO_H=1   -c -o
> pltcl.o pltcl.c
> make[3]: cc: Command not found
> make[3]: *** [pltcl.o] Error 127

You have a broken Tcl installation.

pltcl tries to use the compiler and switches specified in Tcl's
tclConfig.sh file.  Evidently the copy of that file that you have
has nothing to do with your system.

I suggest reinstalling Tcl from source, to make sure that its recorded
build configuration has something to do with reality...

            regards, tom lane

Re: Problems compiling 7.1 with TCL support on Solaris 7

From
Andy Howarth
Date:
Rasputin wrote:

> If fixing tcl is too scary (no offence) just become root and type
>
> ln -s `which gcc` /bin/cc

Tried that, gcc spits out the -KPIC option and then ld joins in the fun
by complaining loudly. (See my original post).

Tom Lane wrote:

> > You have a broken Tcl installation.
> >
> > pltcl tries to use the compiler and switches specified in Tcl's
> > tclConfig.sh file.  Evidently the copy of that file that you have
> > has nothing to do with your system.

Thanks Tom. I asked the colleague who installed it, he obtained and
installed a precompiled binary...

Now all I have to do is get Tk to install properly, never had much luck
with that on Solaris. (Missing X files.)

Here goes. Thanks for the replies.

Regards,
Andy.

Re: psql with PHP question

From
Philip Hallstrom
Date:
Also... is there any reason you don't just do:

SELECT MAX(id) FROM article

rather than what you have below?  It would get you the same thing wouldn't
it and save a query...

On Thu, 3 May 2001, Chris Ryan wrote:

> Jason,
>
>     Look into the pg_result() function. You would use it something like
> this:
>
> $q = pg_Exec("SELECT id FROM article WHERE id=(SELECT MAX(id) FROM
> article)");
> $maxid = pg_result($q,0,0); # pg_result($result,$row,$column_num)
> echo "The highest id is ". $maxid[0];
>
>     Hope this helps.
>
> Chris Ryan
> chris@greatbridge.com
>
> Jason wrote:
> >
> > Hi, I want to try  and optimize my calls to postgreSQL from PHP.  If
> > I only need one field from a select statement, what should I use?  I am
> > currently using:
> > $q = pg_Exec("SELECT id FROM article WHERE id=(SELECT MAX(id)
> > FROM article)");
> > $maxid = pg_fetch_array($q, 0);
> > echo "The highest id is ". $maxid[0];
> > What can I use besides an array to get a single value? In general, using
> > a single variable always saves more memory than using an array?  Thank
> > you.
> > Jason
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> >
> > http://www.postgresql.org/users-lounge/docs/faq.html
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)




Re: [PHP] psql with PHP question

From
"Gyozo Papp"
Date:
In my opinion, these queries make the same :
SELECT id FROM article WHERE id=(SELECT MAX(id) FROM article);
SELECT MAX(id) FROM article;

but the latter one is much more simple and you do not overload your pg.
(by the way, I think id = (SELECT ...) isn't handled gracefully.)

----- Original Message -----
From: "Jason" <gee308@mediaone.net>
To: <pgsql-php@postgresql.org>
Cc: <pgsql-novice@postgresql.org>; <pgsql-general@postgresql.org>
Sent: 2001. május 3. 14:06
Subject: [PHP] psql with PHP question


> Hi, I want to try  and optimize my calls to postgreSQL from PHP.  If
> I only need one field from a select statement, what should I use?  I am
> currently using:
> $q = pg_Exec("SELECT id FROM article WHERE id=(SELECT MAX(id)
> FROM article)");
> $maxid = pg_fetch_array($q, 0);
> echo "The highest id is ". $maxid[0];
> What can I use besides an array to get a single value? In general, using
> a single variable always saves more memory than using an array?  Thank
> you.
> Jason
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)




Re: [PHP] psql with PHP question

From
Joel Burton
Date:
On Thu, 3 May 2001, Gyozo Papp wrote:

> In my opinion, these queries make the same :
> SELECT id FROM article WHERE id=(SELECT MAX(id) FROM article);
> SELECT MAX(id) FROM article;
>
> but the latter one is much more simple and you do not overload your pg.
> (by the way, I think id = (SELECT ...) isn't handled gracefully.)

Yep, it's much better.

If you want to get more than just the ID, try:

   select * from article order by id desc limit 1;

HTH,
--
Joel Burton   <jburton@scw.org>
Director of Information Systems, Support Center of Washington


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)




Re: Re: psql with PHP question

From
Andrew McMillan
Date:
Philip Hallstrom wrote:
>
> Also... is there any reason you don't just do:
>
> SELECT MAX(id) FROM article
>
> rather than what you have below?  It would get you the same thing wouldn't
> it and save a query...
>
> On Thu, 3 May 2001, Chris Ryan wrote:
>
> > Jason,
> >
> >       Look into the pg_result() function. You would use it something like
> > this:
> >
> > $q = pg_Exec("SELECT id FROM article WHERE id=(SELECT MAX(id) FROM
> > article)");
> > $maxid = pg_result($q,0,0); # pg_result($result,$row,$column_num)
> > echo "The highest id is ". $maxid[0];
> >
> >       Hope this helps.
> >
> > Chris Ryan
> > chris@greatbridge.com
> >
> > Jason wrote:
> > >
> > > Hi, I want to try  and optimize my calls to postgreSQL from PHP.  If
> > > I only need one field from a select statement, what should I use?  I am
> > > currently using:
> > > $q = pg_Exec("SELECT id FROM article WHERE id=(SELECT MAX(id)
> > > FROM article)");

Or even more efficiently:

SELECT id FROM article ORDER BY id DESC LIMIT 1;

Since that will use an index on article.id if article is a big table, has been
vacuum analyzed, and has an index available.

Regards,
                    Andrew.
--
_____________________________________________________________________
           Andrew McMillan, e-mail: Andrew@catalyst.net.nz
Catalyst IT Ltd, PO Box 10-225, Level 22, 105 The Terrace, Wellington
Me: +64(21)635-694, Fax: +64(4)499-5596, Office: +64(4)499-2267xtn709

[PHP] psql with PHP question

From
Jason
Date:
Hi, I want to try  and optimize my calls to postgreSQL from PHP.  If
I only need one field from a select statement, what should I use?  I am
currently using:
$q = pg_Exec("SELECT id FROM article WHERE id=(SELECT MAX(id)
FROM article)");
$maxid = pg_fetch_array($q, 0);
echo "The highest id is ". $maxid[0];
What can I use besides an array to get a single value? In general, using
a single variable always saves more memory than using an array?  Thank
you.
Jason


[PHP] Re: psql with PHP question

From
Philip Hallstrom
Date:
Also... is there any reason you don't just do:

SELECT MAX(id) FROM article

rather than what you have below?  It would get you the same thing wouldn't
it and save a query...

On Thu, 3 May 2001, Chris Ryan wrote:

> Jason,
>
>     Look into the pg_result() function. You would use it something like
> this:
>
> $q = pg_Exec("SELECT id FROM article WHERE id=(SELECT MAX(id) FROM
> article)");
> $maxid = pg_result($q,0,0); # pg_result($result,$row,$column_num)
> echo "The highest id is ". $maxid[0];
>
>     Hope this helps.
>
> Chris Ryan
> chris@greatbridge.com
>
> Jason wrote:
> >
> > Hi, I want to try  and optimize my calls to postgreSQL from PHP.  If
> > I only need one field from a select statement, what should I use?  I am
> > currently using:
> > $q = pg_Exec("SELECT id FROM article WHERE id=(SELECT MAX(id)
> > FROM article)");
> > $maxid = pg_fetch_array($q, 0);
> > echo "The highest id is ". $maxid[0];
> > What can I use besides an array to get a single value? In general, using
> > a single variable always saves more memory than using an array?  Thank
> > you.
> > Jason
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> >
> > http://www.postgresql.org/users-lounge/docs/faq.html
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)




Re: [PHP] psql with PHP question

From
Joel Burton
Date:
On Thu, 3 May 2001, Gyozo Papp wrote:

> In my opinion, these queries make the same :
> SELECT id FROM article WHERE id=(SELECT MAX(id) FROM article);
> SELECT MAX(id) FROM article;
>
> but the latter one is much more simple and you do not overload your pg.
> (by the way, I think id = (SELECT ...) isn't handled gracefully.)

Yep, it's much better.

If you want to get more than just the ID, try:

   select * from article order by id desc limit 1;

HTH,
--
Joel Burton   <jburton@scw.org>
Director of Information Systems, Support Center of Washington


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)




Re: [PHP] psql with PHP question

From
"Gyozo Papp"
Date:
In my opinion, these queries make the same :
SELECT id FROM article WHERE id=(SELECT MAX(id) FROM article);
SELECT MAX(id) FROM article;

but the latter one is much more simple and you do not overload your pg.
(by the way, I think id = (SELECT ...) isn't handled gracefully.)

----- Original Message -----
From: "Jason" <gee308@mediaone.net>
To: <pgsql-php@postgresql.org>
Cc: <pgsql-novice@postgresql.org>; <pgsql-general@postgresql.org>
Sent: 2001. május 3. 14:06
Subject: [PHP] psql with PHP question


> Hi, I want to try  and optimize my calls to postgreSQL from PHP.  If
> I only need one field from a select statement, what should I use?  I am
> currently using:
> $q = pg_Exec("SELECT id FROM article WHERE id=(SELECT MAX(id)
> FROM article)");
> $maxid = pg_fetch_array($q, 0);
> echo "The highest id is ". $maxid[0];
> What can I use besides an array to get a single value? In general, using
> a single variable always saves more memory than using an array?  Thank
> you.
> Jason
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)