Re: Simple PG Sql question (i hope)

Поиск
Список
Период
Сортировка
Искать
От
Joshua D. Drake
Тема
Re: Simple PG Sql question (i hope)
Дата
Msg-id
42F7B6EC.4020608@commandprompt.com
Ответ на
Список
Дерево обсуждения
Updating timestamps Nigel Horne <njh@bandsman.co.uk>
Simple PG Sql question (i hope) Tony Caduto <tony_caduto@amsoftwaredesign.com>
AMD 64 RPM? Tony Caduto <tony_caduto@amsoftwaredesign.com>
Re: AMD 64 RPM? "Joshua D. Drake" <jd@commandprompt.com>
Re: AMD 64 RPM? Tony Caduto <tony_caduto@amsoftwaredesign.com>
Re: AMD 64 RPM? "Joshua D. Drake" <jd@commandprompt.com>
Re: AMD 64 RPM? Tony Caduto <tony_caduto@amsoftwaredesign.com>
Re: AMD 64 RPM? Devrim GUNDUZ <devrim@gunduz.org>
Re: [Pgsqlrpms-hackers] Re: AMD 64 RPM? "Sander Steffann" <steffann@nederland.net>
Re: [Pgsqlrpms-hackers] Re: AMD 64 RPM? Devrim GUNDUZ <devrim@gunduz.org>
Re: Simple PG Sql question (i hope) "Joshua D. Drake" <jd@commandprompt.com>
Re: Simple PG Sql question (i hope) Tony Caduto <tony_caduto@amsoftwaredesign.com>
Re: Simple PG Sql question (i hope) Martijn van Oosterhout <kleptog@svana.org>
Re: Simple PG Sql question (i hope) Tony Caduto <tony_caduto@amsoftwaredesign.com>
Tony Caduto wrote:
> I have a simple query:
> 
> select true,78,'Here is a value' as stringfield, testname from tbltest;
> 
> it returns:
> true as bool
> 78 as int4
> and the string 'Here is a value' as Unknown
> 
> Why is it that all the values besides the string come back with the 
> correct type?
> what is a simple string being returned as unknown instead of varchar or 
> text?

Because it doesn't know what you want it as :) For example in 8.0.3:


template1=# select true,78,'Here is a value' as stringfield;
  bool | ?column? |   stringfield
------+----------+-----------------
  t    |       78 | Here is a value
(1 row)

Or

template1=# select true,78::int4,'Here is a value'::text as stringfield;
  bool | int4 |   stringfield
------+------+-----------------
  t    |   78 | Here is a value
(1 row)


Sincerely,

Joshua D. Drake


> 
> 
> Thanks,
> 
> Tony
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>       choose an index scan if your joining column's datatypes do not
>       match


-- 
Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240
PostgreSQL Replication, Consulting, Custom Programming, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/
В списке pgsql-general по дате отправления
От: Tony Caduto
Дата:
Сообщение: AMD 64 RPM?
От: Matt Miller
Дата:
Сообщение: Testing of MVCC
FAQ