Re: SQL query runs fine on one platform (FreeBSD), but hangs on another (Windows)

From: Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
To: David(dot)I(dot)Noel(at)gmail(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SQL query runs fine on one platform (FreeBSD), but hangs on another (Windows)
Date: 2014-04-29 09:45:20
Message-ID: 535F74B0.5040105@matrix.gatewaynet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 29/04/2014 12:39, David Noel wrote:
> Ehh, to clarify I'm referring to the lone _double_ quotation mark at
> the end of the condition 'health'<>''. I called it a "single quotation
> mark" because it was a quotation mark all by itself, but realize that
> could be misread. Single quotation marks are technically this: '
" (double quotation mark) designates a column name, table name, and rest of database objects.
' (single quotation mark) designates a text literal e.g. 'john', 'david', etc...
'health'<>'' (if that is what you have) means a boolean expression that compares the
literal 'health' with the empty literal '' which is of course always false.
Maybe *health* is a column name somewhere ? In this case it should be written :
"health" <> '' (i.e. comparison between the value of column "health" and the literal value '')
>
> Sorry for the newbie spam -- I can't run
> less-than/greater-than/quotation marks through Google for answers.
>
> On 4/29/14, David Noel <david(dot)i(dot)noel(at)gmail(dot)com> wrote:
>>> select p.*, s.NoOfSentences
>>> from page p,
>>> lateral (select count(*) as NoOfSentences
>>> from sentence s
>>> where s."PageURL" = p."URL") s
>>> where "Classification" like case ... end
>>> order by "PublishDate" desc
>>> limit 100;
>> Great. Thanks so much!
>>
>> Could I make it even simpler and drop the case entirely?
>>
>> select p.*, s.NoOfSentences
>> from page p,
>> lateral (select count(*) as NoOfSentences
>> from sentence s
>> where s."PageURL" = p."URL") s
>> where "Classification" like 'health'
>> order by "PublishDate" desc
>> limit 100;
>>
>> I'm not sure what "case WHEN 'health'<>'' THEN 'health' ELSE '%' end"
>> does. I follow everything just fine until I get to the 'health'<>''
>> condition. What does the single quotation mark mean? I can't seem to
>> find it in the documentation.
>>
>> -David
>>

--
Achilleas Mantzios
Head of IT DEV
IT DEPT
Dynacom Tankers Mgmt

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Noel 2014-04-29 09:54:14 Re: SQL query runs fine on one platform (FreeBSD), but hangs on another (Windows)
Previous Message David Noel 2014-04-29 09:39:04 Re: SQL query runs fine on one platform (FreeBSD), but hangs on another (Windows)