pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
PLEASE, HELP!
7+ messages / 5 participants
[nested] [flat]

* PLEASE, HELP!
@ 1999-01-27 17:27  Juan Pablo Marichal Catalan <jpmarichal@infoacces.com>
  0 siblings, 0 replies; 7+ messages in thread

From: jpmarichal@infoacces.com @ 1999-01-27 17:27 UTC (permalink / raw)
  To: pgsql-sql

I cant' find the way!

I'm building a system to a contest. I have three tables: participantes (partakers), ordenes (orders) and productos (products). Partakers on the contest introduce their id in an HTML form, then this calls a PHP to query the database and return data taken from the three tables.

Using Microsoft Access, I get the SQL code for the query, then I copy it and paste it in my PHP code:

$result=pg_Exec($conn,"SELECT participantes.idven, participantes.nombreven, participantes.iding, participantes.nombreing, participantes.empresa, ordenes.num_ordenuf, ordenes.factura_spasp, ordenes.factura_vad, ordenes.fecha, ordenes.num_producto, productos.descripcion, ordenes.mayorista, productos.puntos, ordenes.cantidad, [puntos]*[cantidad] AS Total FROM productos INNER JOIN (participantes INNER JOIN ordenes ON idven = participante) ON idproducto = num_producto WHERE (((idven)="VHA1901081"))");

But Postgress don't accept the . operator, so it drops to me those nasty 'parse' error messages. I don't know if it's only due to the . operator, or the use of upper case or what. How must I build the SQL query to be accepted by Postgress and PHP? I'm drowning on it!


______________________
Brotherly,
JPMarichal
jpmarichal@infoacces.com
ICQ# 17246887



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* RE: [PHP3] PLEASE, HELP!
@ 1999-01-27 18:14  Jackson, DeJuan <djackson@cpsgroup.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Jackson, DeJuan @ 1999-01-27 18:14 UTC (permalink / raw)
  To: jpmarichal@infoacces.com; php3@lists.php.net; +Cc: pgsql-sql

TRY:
SELECT participantes.idven, 
participantes.nombreven, participantes.iding, 
participantes.nombreing, participantes.empresa, 
ordenes.num_ordenuf, ordenes.factura_spasp, 
ordenes.factura_vad, ordenes.fecha, ordenes.num_producto, 
productos.descripcion, ordenes.mayorista, productos.puntos, 
ordenes.cantidad, puntos*cantidad AS "Total" 
FROM productos, participantes, ordenes
WHERE participantes.idven = ordenes.participante AND
      idproducto = ordenes.num_producto AND 
      participantes.idven="VHA1901081"

Postgres doesn't yet support the SQL 92 INNER JOIN Syntax.  It should be
fairly obvious what I did to your original query if you look closely.
	-DEJ

> You're right, I've prove it. Now, anybody may help me to 
> locate the error? 
> 
> See, once that I convert all to lowercase, PHP still send me 
> this error:
> 
> Warning: PostgresSQL query failed: ERROR: parser: parse error 
> at or near "inner" in 
> /usr/local/apache/share/htdocs/consulta_concentrado.php3 on line 18
> 
> The query is now the following:
> 
> $result=pg_Exec($conn,"select idven, nombreven, iding, 
> nombreing, empresa, num_ordenuf, factura_spasp, factura_vad, 
> fecha, num_producto, descripcion, mayorista, puntos, cantidad 
> from productos inner join participantes inner join ordenes on 
> participantes.idven = ordenes.participante on 
> productos.idproducto = ordenes.num_producto where 
> idven='VHA1901081'");
> 
> $result is 0 (fail). I'm not still using the . operator in 
> all the clauses, but I'm sure that the problem is not located 
> there. I'm getting crazy trying to isolate the problem. 
> Somebody has any idea?
> 
> 
> *********** REPLY SEPARATOR ***********
> 
> On 27/01/99, at 12:53 PM, Jeremiah Davis wrote: 
> 
> >Actually, Postgres does accept the . operator in the form
> >
> >SELECT table.column,table2.column,table3.column FROM 
> table,table2,table3;
> >
> >Your problem is somewhere else in the SQL code that access 
> generated for
> >you.
> >
> >
> >On Wed, 27 Jan 1999, Juan Pablo Marichal Catalan wrote:
> >
> >> I cant' find the way!
> >> 
> >> I'm building a system to a contest. I have three tables: 
> participantes (partakers), ordenes (orders) and productos 
> (products). Partakers on the contest introduce their id in an 
> HTML form, then this calls a PHP to query the database and 
> return data taken from the three tables.
> >> 
> >> Using Microsoft Access, I get the SQL code for the query, 
> then I copy it and paste it in my PHP code:
> >> 
> >> $result=pg_Exec($conn,"SELECT participantes.idven, 
> participantes.nombreven, participantes.iding, 
> participantes.nombreing, participantes.empresa, 
> ordenes.num_ordenuf, ordenes.factura_spasp, 
> ordenes.factura_vad, ordenes.fecha, ordenes.num_producto, 
> productos.descripcion, ordenes.mayorista, productos.puntos, 
> ordenes.cantidad, [puntos]*[cantidad] AS Total FROM productos 
> INNER JOIN (participantes INNER JOIN ordenes ON idven = 
> participante) ON idproducto = num_producto WHERE 
> (((idven)="VHA1901081"))");
> >> 
> >> But Postgress don't accept the . operator, so it drops to 
> me those nasty 'parse' error messages. I don't know if it's 
> only due to the . operator, or the use of upper case or what. 
> How must I build the SQL query to be accepted by Postgress 
> and PHP? I'm drowning on it!
> >> 
> >> 
> >> ______________________
> >> Brotherly,
> >> JPMarichal
> >> jpmarichal@infoacces.com
> >> ICQ# 17246887
> >> 
> >> --
> >> PHP 3 Mailing List   http://www.php.net/
> >> To unsubscribe send an empty message to 
> php3-unsubscribe@lists.php.net
> >> To subscribe to the digest list:  
> php3-digest-subscribe@lists.php.net
> >> For help: php3-help@lists.php.net  Archive:  
> http://www.php.net/mailsearch.php3
> >> List administrator:  
> zeev-list-admin@zend.com
> >> 
> >>
> 
> ______________________
> Brotherly,
> JPMarichal
> jpmarichal@infoacces.com
> ICQ# 17246887
> 
> --
> PHP 3 Mailing List   http://www.php.net/
> To unsubscribe send an empty message to php3-unsubscribe@lists.php.net
> To subscribe to the digest list:  php3-digest-subscribe@lists.php.net
> For help: php3-help@lists.php.net  Archive:  
> http://www.php.net/mailsearch.php3
> List administrator:  
> zeev-list-admin@zend.com
> 
> 



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* please help
@ 2001-04-05 16:14  Loïc Bourgeois <loic.bourgeois@mobileway.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Loïc Bourgeois @ 2001-04-05 16:14 UTC (permalink / raw)
  To: pgsql-sql

What is the equivalent of the oracle request: SELECT ... FOR UPDATE 
NOWAIT, under PostGreSQL


Thanks a lot




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: please help
@ 2001-04-05 19:40  Peter Eisentraut <peter_e@gmx.net>
  parent: Loïc Bourgeois <loic.bourgeois@mobileway.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Peter Eisentraut @ 2001-04-05 19:40 UTC (permalink / raw)
  To: Loïc Bourgeois <loic.bourgeois@mobileway.com>; +Cc: pgsql-sql

Loïc Bourgeois writes:

> What is the equivalent of the oracle request: SELECT ... FOR UPDATE
> NOWAIT, under PostGreSQL

I don't know Oracle, but there doesn't seem to be such a command in
PostgreSQL.  If the table is already locked, the SELECT FOR UPDATE has to
wait.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: please help
@ 2001-04-06 07:19  Loïc Bourgeois <loic.bourgeois@mobileway.com>
  parent: Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 1 reply; 7+ messages in thread

From: Loïc Bourgeois @ 2001-04-06 07:19 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-sql

Yes but the option NOWAIT say to the instruction SELECT ... FOR UPDATE 
to not wait the unlock but to return the information the lines can't be 
lock.
(Must retry late).


Peter Eisentraut wrote:

> Loïc Bourgeois writes:
> 
>> What is the equivalent of the oracle request: SELECT ... FOR UPDATE
>> NOWAIT, under PostGreSQL
> 
> 
> I don't know Oracle, but there doesn't seem to be such a command in
> PostgreSQL.  If the table is already locked, the SELECT FOR UPDATE has to
> wait.
> 

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: please help
@ 2001-04-08 22:55  Cedar Cox <cedarc@visionforisrael.com>
  parent: Loïc Bourgeois <loic.bourgeois@mobileway.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Cedar Cox @ 2001-04-08 22:55 UTC (permalink / raw)
  To: Loïc Bourgeois <loic.bourgeois@mobileway.com>; +Cc: pgsql-sql


It would be somewhat (very) useful to have something like this.  We were
toying with the idea of making some sort of system to figure out if a
table is locked or not.  In the end we decided to go with executing this
asynchronously and after a given timeout ask the user if they would like
to wait or cancel the request.  Something like this may or may not work
for you..

-Cedar


On Fri, 6 Apr 2001, Loïc Bourgeois wrote:

> Yes but the option NOWAIT say to the instruction SELECT ... FOR UPDATE 
> to not wait the unlock but to return the information the lines can't be 
> lock.
> (Must retry late).
> 
> 
> Peter Eisentraut wrote:
> 
> > Loïc Bourgeois writes:
> > 
> >> What is the equivalent of the oracle request: SELECT ... FOR UPDATE
> >> NOWAIT, under PostGreSQL
> > 
> > 
> > I don't know Oracle, but there doesn't seem to be such a command in
> > PostgreSQL.  If the table is already locked, the SELECT FOR UPDATE has to
> > wait.
> > 
> 
> 




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: please help
@ 2001-04-09 16:01  Peter Eisentraut <peter_e@gmx.net>
  parent: Cedar Cox <cedarc@visionforisrael.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Peter Eisentraut @ 2001-04-09 16:01 UTC (permalink / raw)
  To: Cedar Cox <cedarc@visionforisrael.com>; +Cc: Loïc Bourgeois <loic.bourgeois@mobileway.com>; pgsql-sql

Cedar Cox writes:

> It would be somewhat (very) useful to have something like this.  We were
> toying with the idea of making some sort of system to figure out if a
> table is locked or not.

This will probably introduce race conditions unless done very carefully.
In theory you need a second level of locks to protect the information you
obtained regarding the "real" locks.  I'm not saying it's impossible, but
20 years ago people were writing Ph.D. theses about these sort of things.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/




^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2001-04-09 16:01 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-01-27 17:27 PLEASE, HELP! Juan Pablo Marichal Catalan <jpmarichal@infoacces.com>
1999-01-27 18:14 RE: [PHP3] PLEASE, HELP! Jackson, DeJuan <djackson@cpsgroup.com>
2001-04-05 16:14 please help Loïc Bourgeois <loic.bourgeois@mobileway.com>
2001-04-05 19:40 ` Re: please help Peter Eisentraut <peter_e@gmx.net>
2001-04-06 07:19   ` Re: please help Loïc Bourgeois <loic.bourgeois@mobileway.com>
2001-04-08 22:55     ` Re: please help Cedar Cox <cedarc@visionforisrael.com>
2001-04-09 16:01       ` Re: please help Peter Eisentraut <peter_e@gmx.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox