Обсуждение: scan.c:900: warning: ... postgresql-7.1
Does anyone get the same warning messages from postgresql-7.1? It's under src/backend/parser... scan.c: In function `base_yylex': scan.c:900: warning: `yy_cp' might be used uninitialized in this function scan.c:900: warning: `yy_bp' might be used uninitialized in this function Here is the scan.c line 900 -- register char *yy_cp, *yy_bp; -- In my previous postgres copy (7.1 beta 4), I did find the initialization for these two variables in scan.c. Can anyone please tell me why the init. is removed? Thank you very much. -- LM Liu
Limin Liu <limin@pumpkinnet.com> writes:
> Does anyone get the same warning messages from postgresql-7.1?
> It's under src/backend/parser...
> scan.c: In function `base_yylex':
> scan.c:900: warning: `yy_cp' might be used uninitialized in this
> function
> scan.c:900: warning: `yy_bp' might be used uninitialized in this
> function
I get no such warning. Have you regenerated scan.c locally, and if so
what version of flex did you use?
regards, tom lane
> > scan.c: In function `base_yylex': > > scan.c:900: warning: `yy_cp' might be used uninitialized in this > > function > > scan.c:900: warning: `yy_bp' might be used uninitialized in this > > function > > I get no such warning. Have you regenerated scan.c locally, and if so No, I didn't. I un-tar the postgresql-7.1.tar.gz again and the scan.c line 900 shows no initialization. > > what version of flex did you use? > I have flex version 2.5.4 Thanx -- LM Liu
Limin Liu <limin@pumpkinnet.com> writes:
>> I get no such warning. Have you regenerated scan.c locally, and if so
> No, I didn't. I un-tar the postgresql-7.1.tar.gz again and the scan.c
> line 900 shows no initialization.
No, but it doesn't need to. Both variables are assigned before first
use, as even an extremely stupid compiler should be able to figure out.
What compiler version are you using, and with what command-line switches?
regards, tom lane
> No, but it doesn't need to. Both variables are assigned before first
> use, as even an extremely stupid compiler should be able to figure out.
:-) I agree.
>
> What compiler version are you using, and with what command-line switches?
>
Here is what I have
% gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
I believe this compiler is not that old.
After I un-tar the .gz, I run ./configure with prefix then gmake. That's
it.
I first see warning in lex.Int_yy.c, than scan.c. Here are those message,
hope this can help.
======================
gmake[3]: Entering directory `/tmp/tmp/postgresql-7.1/src/backend/bootstrap'
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-error
-I../../../src/include -c
-o bootparse.o bootparse.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-error
-I../../../src/include -c
-o bootscanner.o bootscanner.c
lex.Int_yy.c: In function `Int_yylex':
lex.Int_yy.c:689: warning: `Int_yy_cp' might be used uninitialized in this
function
lex.Int_yy.c:689: warning: `Int_yy_bp' might be used uninitialized in this
function
:
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-error
-I../../../src/include -c
-o scan.o scan.c
scan.c: In function `base_yylex':
scan.c:900: warning: `yy_cp' might be used uninitialized in this function
scan.c:900: warning: `yy_bp' might be used uninitialized in this function
:
pgc.c: In function `yylex':
pgc.c:1243: warning: label `find_rule' defined but not used
pgc.c:1178: warning: `yy_cp' might be used uninitialized in this function
pgc.c:1178: warning: `yy_bp' might be used uninitialized in this function
pgc.c: At top level:
pgc.c:3091: warning: `yy_flex_realloc' defined but not used
======================
configure does find flex and bison...
:
checking for flex... /usr/bin/flex
checking whether ln -s works... yes
checking for ld used by GCC... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for ranlib... ranlib
checking for lorder... no
checking for tar... /bin/tar
checking for perl... perl
checking for bison... bison -y
:
Everything looks fine to me and the previous copy (7.1 beta4) doesn't give
me any warning message. That's why I am curious what's going on...
Thanks for your help
--
LM Liu
Limin Liu <limin@pumpkinnet.com> writes:
>> What compiler version are you using, and with what command-line switches?
> % gcc -v
> Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
> gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
> I believe this compiler is not that old.
Two years is a long time... I have been using gcc 2.95.2 until about two
weeks ago, when I updated to 2.95.3. Neither of them complain about
this file, and I have not heard any reports of complaints from other
people about it either.
> Everything looks fine to me and the previous copy (7.1 beta4) doesn't give
> me any warning message. That's why I am curious what's going on...
There were some irrelevant-looking changes in scan.l between beta4 and
release, which perhaps could have triggered this glitch.
Actually, what's even more interesting is that you get the same bogus
warning messages from bootscanner.c. I presume you weren't seeing that
before, either? bootscanner.l has not changed (except for a
copyright-notice update) since 7.1beta1. It's hard to draw any other
conclusion than that something has gone wrong with your compiler
installation. Is it possible your disk dropped a bit, or something
like that?
regards, tom lane
> Two years is a long time... I have been using gcc 2.95.2 until about two > weeks ago, when I updated to 2.95.3. Neither of them complain about > this file, and I have not heard any reports of complaints from other > people about it either. > I think I will update my compiler, since I have no clue some to answer your following question! :-) > > installation. Is it possible your disk dropped a bit, or something > like that? > Thank you very much -- LM Liu
Don't know if this would be the correct place to ask this. We have a
postgresql server running version 6.5.3
It hosts a 100 or so different databases, and performs just great. I do
however have one query which takes about 20 seconds to complete. The
database only has 200-300 records. Don't know much about SQL other than
simple selects and inserts. I'm the one who created the query in
question, and even today when I look at it, I'm not sure I understand
it, but it gives us the results we want, it's just very slow.
I'm sure someone with some SQL know-how could probably shorten this
query down some. But it's way over my head.
Basically I've got a database with these tables:
client (list of clients)
project (each project belongs to a client)
subproject (each subproject belongs to a project)
status (each project has a status)
users (each project and subproject are assigned to a user)
timelog (each timelog record indicates time worked on a particular
subproject and who worked on it)
A sample row would look like this:
project_id|project_title|clientid|status|percentcomplete|duedate
|usersid|client_id|name
|users_id|users_name|status_id|status_name|hoursworked
----------+-------------+--------+------+---------------+----------+-------+
---------+-----------+--------+----------+---------+-----------+-----------
143|project 1 | 79| 3|
100|04-06-2001| 8| 79|Client Name| 8| Kevin|
3|status | 1
The query is below. Again if this is not the appropriate list for such a
question, my apologies.
Kevin
*******************
SELECT
p1.project_id, p1.project_title, p1.clientid, p1.status,
p1.percentcomplete, p1.duedate, p1.usersid,
c2.client_id, c2.name,
u3.users_id, u3.users_name,
s4.status_id, s4.status_name,
sum(case when t.jobid=s.subproject_id then t.timespent else 0::float4
end) as hoursworked
FROM
project p1, client c2, users u3, status s4, timelog t, subproject s
WHERE
(s4.status_id=2 OR s4.status_id=3) AND
(c2.client_id=p1.clientid) AND (u3.users_id=p1.usersid) AND
(s4.status_id=p1.status) AND (p1.project_id=s.projectid)
GROUP BY
p1.project_id, p1.project_title, p1.clientid, p1.status,
p1.percentcomplete, p1.duedate, p1.usersid,
c2.client_id, c2.name, u3.users_id, u3.users_name, s4.status_id,
s4.status_name
UNION SELECT
p1.project_id, p1.project_title, p1.clientid, p1.status,
p1.percentcomplete, p1.duedate, p1.usersid,
c2.client_id, c2.name,
u3.users_id, u3.users_name,
s4.status_id, s4.status_name,
0 as hoursworked
FROM
project p1,client c2,users u3,status s4, subproject s
WHERE
(s4.status_id=2 OR s4.status_id=3) AND
(c2.client_id=p1.clientid) AND (u3.users_id=p1.usersid) AND
(s4.status_id=p1.status) AND
NOT EXISTS
(Select s.subproject_id from subproject s where
s.projectid=p1.project_id)
GROUP BY
p1.project_id, p1.project_title, p1.clientid, p1.status,
p1.percentcomplete, p1.duedate, p1.usersid,
c2.client_id, c2.name, u3.users_id, u3.users_name, s4.status_id,
s4.status_name
ORDER BY p1.project_title
On Tue, 17 Apr 2001, Kevin Heflin wrote: > Don't know if this would be the correct place to ask this. We have a > postgresql server running version 6.5.3 > It hosts a 100 or so different databases, and performs just great. I do > however have one query which takes about 20 seconds to complete. The > database only has 200-300 records. Don't know much about SQL other than > simple selects and inserts. I'm the one who created the query in > question, and even today when I look at it, I'm not sure I understand > it, but it gives us the results we want, it's just very slow. > > I'm sure someone with some SQL know-how could probably shorten this > query down some. But it's way over my head. > > Basically I've got a database with these tables: > client (list of clients) > project (each project belongs to a client) > subproject (each subproject belongs to a project) > status (each project has a status) > users (each project and subproject are assigned to a user) > timelog (each timelog record indicates time worked on a particular > subproject and who worked on it) > > A sample row would look like this: > > > project_id|project_title|clientid|status|percentcomplete|duedate > |usersid|client_id|name > |users_id|users_name|status_id|status_name|hoursworked > ----------+-------------+--------+------+---------------+----------+-------+ > ---------+-----------+--------+----------+---------+-----------+----------- > 143|project 1 | 79| 3| > 100|04-06-2001| 8| 79|Client Name| 8| Kevin| > 3|status | 1 Kevin -- Looking quickly at your problem, I have one or two ideas, but need to play for a few minutes. Can you post a schema and a small amount of data? -- Joel Burton <jburton@scw.org> Director of Information Systems, Support Center of Washington