Re: Error after upgrade
| От | Tom Lane |
|---|---|
| Тема | Re: Error after upgrade |
| Дата | |
| Msg-id | 4178.1201542063@sss.pgh.pa.us обсуждение |
| Ответ на | Error after upgrade ("Paul Houselander" <housey@sme-ecom.co.uk>) |
| Список | pgsql-general |
"Paul Houselander" <housey@sme-ecom.co.uk> writes:
> $uweeklysqlu = "UPDATE stats_? SET
> statdate=?,inctr=inctr+?,insize=insize+?,inspam=inspam+?,invir=invir+?,outct
> r=outctr+?,outsize=outsize+?,outspam=outspam+?,outvir=outvir+? WHERE
> account=? AND stattype=? AND statmode=? AND extract(week from
> statdate)=extract(week from date ?) and extract(year from
> statdate)=extract(year from date ?)";
"date ?" is incorrect. You got away with it before because you were
using an older driver that substituted a literal constant into the query
before sending it (ie, the query wasn't really prepared at all). The
right way is "?::date", or more verbosely "CAST(? AS date)". See the
discussions of casting and assigning types to constants in sections
4.1.2.5 and 4.2.8 of the manual.
I doubt that "stats_?" as a table name is going to work either.
regards, tom lane
В списке pgsql-general по дате отправления: