[SQL] There is a different cast than ::MyOtherType() ?
Hi list, My Delphi app does not suport this kind of cast: Select id, desc::Varchar(50) from myTable I don't know if it is a odbc problem or a Delphi problem (or a BDE problem). *Even though I would like to try another cast. Does anyone is avaliable to help me ? *-- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Atenciosamente (Sincerely) Ezequias Rodrigues da Rocha =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- A pior das democracias ainda é melhor do que a melhor das ditaduras The worst of democracies is still better than the better of dictatorships http://ezequiasrocha.blogspot.com/
Re: [SQL] Retrieving 'Credit' when 'C'
Perfect, I learn this lesson now. This case is quite good. My Best Regards Ezequias 2007/2/15, Phillip Smith <[EMAIL PROTECTED]>: SELECT when, CASE WHEN type = 'C' THEN 'Credit' END AS type FROMmytable; Assuming your column names are actually "when" and "type" you should just have to change "mytable" to the correct table name and run in psql or the SQL Window of pgAdmin or wherever you usually run your SQL queries to get what you want. -Original Message- *From:* [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] *On Behalf Of *Ezequias Rodrigues da Rocha *Sent:* Friday, 16 February 2007 03:45 *To:* Ezequias Rodrigues da Rocha; [email protected] *Subject:* Re: [SQL] Retrieving 'Credit' when 'C' Just a question, where to put it ? I didn't notice yet. Confidentiality and Privilege Notice The material contained in this message is privileged and confidential to the addressee. If you are not the addressee indicated in this message or responsible for delivery of the message to such person, you may not copy or deliver this message to anyone, and you should destroy it and kindly notify the sender by reply email. Information in this message that does not relate to the official business of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta. Weatherbeeta, its employees, contractors or associates shall not be liable for direct, indirect or consequential loss arising from transmission of this message or any attachments -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Atenciosamente (Sincerely) Ezequias Rodrigues da Rocha =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- A pior das democracias ainda é melhor do que a melhor das ditaduras The worst of democracies is still better than the better of dictatorships http://ezequiasrocha.blogspot.com/
Re: [SQL] can someone explain confusing array indexing nomenclature
Στις Πέμπτη 15 Φεβρουάριος 2007 18:55, ο/η chrisj έγραψε:
> Thanks Achilleas,
>
> I see what you are saying, but if we consider just the index "[2]" for a
> moment,
> it means something different depending upon the context (in one case it
> means "2" and in the other case it means "1:2") and the context is
> determined by the format of indexes on other dimensions.
>
> I believe I understandbut incredibly confusing.
>
Now that i think about it again, i speculate that the [2] is discarded.
> - chris
>
> Achilleas Mantzios wrote:
> > Ξ£ΟΞΉΟ Ξ�Ξ΅ΟΞ¬ΟΟΞ· 14 ΦΡβΟΞΏΟ
Ξ¬ΟΞΉΞΏΟ 2007 21:31, ΞΏ/Ξ· chrisj
ΞΞ³ΟΞ±ΟΞ΅:
> >> given the following table:
> >>
> >> protocal2=> select * from sal_emp ;
> >> name | pay_by_quarter | schedule
> >> ---+---+
> >>--- Bill | {1,1,1,1} |
> >> {{meeting,lunch},{training,presentation}}
> >> Carol | {2,25000,25000,25000} |
> >> {{breakfast,consulting},{meeting,lunch}}
> >> (2 rows)
> >>
> >> why do the following two queries yield different results??
> >>
> >> protocal2=> SELECT schedule[1][2] FROM sal_emp WHERE name = 'Bill';
> >> schedule
> >> --
> >> lunch
> >> (1 row)
> >>
> >> protocal2=> SELECT schedule[1:1][2] FROM sal_emp WHERE name = 'Bill';
> >> schedule
> >> ---
> >> {{meeting,lunch}}
> >> (1 row)
> >
> > The [n:m] notation denotes a slice of the array (not element).
> > So schedule[1][2] is the Array element on 2nd col of 1st row,
> > while schedule[1:1][2] could mean
> > the second row of the subarray schedule[1:1][1:2].
> > So these two are foundamentally different things.
> > In my 7.4 even if you gave
> > SELECT schedule[1:1][888] FROM sal_emp WHERE name = 'Bill';
> > you would still get {{meeting,lunch}} as a result.
> > (Right or wrong is another story).
> > Anyway the first time you query for a "text",
> > the second time you query for a "text[]", so you should expect
> > different results.
> > --
> > Achilleas Mantzios
> >
> > ---(end of broadcast)---
> > TIP 3: Have you checked our extensive FAQ?
> >
> >http://www.postgresql.org/docs/faq
--
Achilleas Mantzios
---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq
Re: [SQL] There is a different cast than ::MyOtherType() ?
Ezequias Rodrigues da Rocha escribió: > Hi list, > > My Delphi app does not suport this kind of cast: > > Select id, desc::Varchar(50) from myTable Try select id, cast(desc as varchar(50)) from yourTable -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings
Re: [SQL] There is a different cast than ::MyOtherType() ?
am Fri, dem 16.02.2007, um 9:30:14 -0300 mailte Ezequias Rodrigues da Rocha folgendes: > Hi list, > > My Delphi app does not suport this kind of cast: > > Select id, desc::Varchar(50) from myTable This is PG-only-style, the spec is: select id, cast(desc as varchar(50)) from mytable; But i'm not sure if 'desc' is a reserved key-word. Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings
Re: [SQL] can someone explain confusing array indexing nomenclature
I am quite sure the [2] is not discarded, easy enough to test but I don't
have access to PG at the moment.
Achilleas Mantzios wrote:
>
> Στις Πέμπτη 15 Φεβρουάριος 2007 18:55, ο/η chrisj έγραψε:
>> Thanks Achilleas,
>>
>> I see what you are saying, but if we consider just the index "[2]" for a
>> moment,
>> it means something different depending upon the context (in one case it
>> means "2" and in the other case it means "1:2") and the context is
>> determined by the format of indexes on other dimensions.
>>
>> I believe I understandbut incredibly confusing.
>>
>
> Now that i think about it again, i speculate that the [2] is discarded.
>
>> - chris
>>
>> Achilleas Mantzios wrote:
>> > Ξ£ΟΞΉΟ Ξ�Ξ΅ΟΞ¬ΟΟΞ· 14 ΦΡβΟΞΏΟ
Ξ¬ΟΞΉΞΏΟ 2007 21:31, ΞΏ/Ξ·
>> chrisj
> ΞΞ³ΟΞ±ΟΞ΅:
>> >> given the following table:
>> >>
>> >> protocal2=> select * from sal_emp ;
>> >> name | pay_by_quarter | schedule
>> >>
>> ---+---+
>> >>--- Bill | {1,1,1,1} |
>> >> {{meeting,lunch},{training,presentation}}
>> >> Carol | {2,25000,25000,25000} |
>> >> {{breakfast,consulting},{meeting,lunch}}
>> >> (2 rows)
>> >>
>> >> why do the following two queries yield different results??
>> >>
>> >> protocal2=> SELECT schedule[1][2] FROM sal_emp WHERE name = 'Bill';
>> >> schedule
>> >> --
>> >> lunch
>> >> (1 row)
>> >>
>> >> protocal2=> SELECT schedule[1:1][2] FROM sal_emp WHERE name = 'Bill';
>> >> schedule
>> >> ---
>> >> {{meeting,lunch}}
>> >> (1 row)
>> >
>> > The [n:m] notation denotes a slice of the array (not element).
>> > So schedule[1][2] is the Array element on 2nd col of 1st row,
>> > while schedule[1:1][2] could mean
>> > the second row of the subarray schedule[1:1][1:2].
>> > So these two are foundamentally different things.
>> > In my 7.4 even if you gave
>> > SELECT schedule[1:1][888] FROM sal_emp WHERE name = 'Bill';
>> > you would still get {{meeting,lunch}} as a result.
>> > (Right or wrong is another story).
>> > Anyway the first time you query for a "text",
>> > the second time you query for a "text[]", so you should expect
>> > different results.
>> > --
>> > Achilleas Mantzios
>> >
>> > ---(end of
>> broadcast)---
>> > TIP 3: Have you checked our extensive FAQ?
>> >
>> >http://www.postgresql.org/docs/faq
>
> --
> Achilleas Mantzios
>
> ---(end of broadcast)---
> TIP 3: Have you checked our extensive FAQ?
>
>http://www.postgresql.org/docs/faq
>
>
--
View this message in context:
http://www.nabble.com/can-someone-explain-confusing-array-indexing-nomenclature-tf3229165.html#a9009934
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
---(end of broadcast)---
TIP 4: Have you searched our list archives?
http://archives.postgresql.org
[SQL] Debug (is it PostgreSQL?)
My Linux is reporting the following message: DEBUG: Connection stats: total - 1, free - 0, deleted - 0 DEBUG: Checking for jobs to run DEBUG: Sleeping... DEBUG: Clearing inactive connections DEBUG: Connection stats: total - 1, free - 0, deleted - 0 DEBUG: Checking for jobs to run DEBUG: Sleeping... DEBUG: Clearing inactive connections DEBUG: Connection stats: total - 1, free - 0, deleted - 0 DEBUG: Checking for jobs to run DEBUG: Sleeping... DEBUG: Clearing inactive connections DEBUG: Connection stats: total - 1, free - 0, deleted - 0 DEBUG: Checking for jobs to run DEBUG: Sleeping... DEBUG: Clearing inactive connections DEBUG: Connection stats: total - 1, free - 0, deleted - 0 DEBUG: Checking for jobs to run DEBUG: Sleeping... DEBUG: Clearing inactive connections DEBUG: Connection stats: total - 1, free - 0, deleted - 0 DEBUG: Checking for jobs to run DEBUG: Sleeping... DEBUG: Clearing inactive connections DEBUG: Connection stats: total - 1, free - 0, deleted - 0 DEBUG: Checking for jobs to run DEBUG: Sleeping... DEBUG: Clearing inactive connections DEBUG: Connection stats: total - 1, free - 0, deleted - 0 DEBUG: Checking for jobs to run DEBUG: Sleeping... DEBUG: Clearing inactive connections DEBUG: Connection stats: total - 1, free - 0, deleted - 0 DEBUG: Checking for jobs to run DEBUG: Sleeping... DEBUG: Clearing inactive connections DEBUG: Connection stats: total - 1, free - 0, deleted - 0 DEBUG: Checking for jobs to run DEBUG: Sleeping... DEBUG: Clearing inactive connections DEBUG: Connection stats: total - 1, free - 0, deleted - 0 DEBUG: Checking for jobs to run DEBUG: Sleeping... DEBUG: Clearing inactive connections DEBUG: Connection stats: total - 1, free - 0, deleted - 0 DEBUG: Checking for jobs to run DEBUG: Sleeping... DEBUG: Clearing inactive connections DEBUG: Connection stats: total - 1, free - 0, deleted - 0 DEBUG: Checking for jobs to run DEBUG: Sleeping... DEBUG: Clearing inactive connections DEBUG: Connection stats: total - 1, free - 0, deleted - 0 DEBUG: Checking for jobs to run DEBUG: Sleeping... DEBUG: Clearing inactive connections DEBUG: Connection stats: total - 1, free - 0, deleted - 0 DEBUG: Checking for jobs to run DEBUG: Sleeping... DEBUG: Clearing inactive connections DEBUG: Connection stats: total - 1, free - 0, deleted - 0 DEBUG: Checking for jobs to run DEBUG: Sleeping... Can someone tell me what is it ?
