Re: [SQL] to_char() accepting invalid dates?

2011-07-20 Thread Thomas Kellerer

Bruce Momjian, 20.07.2011 03:03:

Well, to_char() is based on Oracle's to_char().  How does Oracle handle
such a date?


Oracle throws an error for the above example:

SQL>  select to_date('20110231', 'MMDD') from dual;
select to_date('20110231', 'MMDD') from dual
 *
ERROR at line 1:
ORA-01839: date not valid for month specified

SQL>


OK, it's a bug then.  Let me see if I can find a fix for it.


Thanks for the info. I didn't know it was modelled after the Oracle 
implementation.

Regards
Thomas

 




--
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


[SQL] compile postgres with visual studio 2010

2011-07-20 Thread Sofer, Yuval
Hi 

I would like to build Postgres from source with the visual studio 2010 compiler

Is it supported? Is there any document which describes the process of the 
implementation? 

Thanks, 


Yuval Sofer
BMC Software
CTM&D Business Unit
DBA Team
972-52-4286-282
[email protected]


-- 
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] compile postgres with visual studio 2010

2011-07-20 Thread Kevin Crain
The documentation only mentions Visual Studio 2005 and Visual Studio
2008, but I see no reason why it shouldn't work.  Check out the
requirements listed in the documentation:
http://www.postgresql.org/docs/9.0/interactive/install-windows-full.html

On Wed, Jul 20, 2011 at 3:55 AM, Sofer, Yuval  wrote:
> Hi
>
> I would like to build Postgres from source with the visual studio 2010 
> compiler
>
> Is it supported? Is there any document which describes the process of the 
> implementation?
>
> Thanks,
>
>
> Yuval Sofer
> BMC Software
> CTM&D Business Unit
> DBA Team
> 972-52-4286-282
> [email protected]
>
>
> --
> Sent via pgsql-sql mailing list ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>

-- 
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


[SQL] LTREE extension and "order by"

2011-07-20 Thread Ivan Polak
Hi,

in postgreSQL (with LTREE extension) database I have the following
table "comments":

id BIGINT /* id */
article_id BIGINT /*article-id */
parent_id BIGINT
comment TEXT
path LTREE
level INTEGER /* level */

with the following rows:

id article_id comment parent_id path level
1 1  1 1
2 1  1 1.2 2
3 1  2 1.2.3 3
4 1  2 1.4 2
5 1  4 1.4.5 3
6 1  6 1
7 1  6 6.7 2
8 1  6 6.8 2
9 1  9 1
10 1  10 1
11 1  5 1.4.5.11 4

and I need to select complete tree (with correct order of comments).

SELECT * from comments where article_id = 2 order by 

when I used:

SELECT * from comments where article_id = 2 order by path

the result is:

id comment path
1  1
2  1.2
3  1.2.3
4  1.4
5  1.4.5
11  1.4.5.11
10  10
6  6
7  6.7
8  6.8
9  9

BUT, it is wrong, because comment with id = 10 is after comment with id=11

(i know, this is correct, because ordering by column PATH [as TEXT],
and 10 is 'after' 1.4.5.11)

, but I need :

id comment path
1  1
2  1.2
3  1.2.3
4  1.4
5  1.4.5
11  1.4.5.11
6  6
7  6.7
8  6.8
9  9
10  10

thanks

Ivan

-- 
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] LTREE extension and "order by"

2011-07-20 Thread pasman pasmaƄski
Hi.

You should convert path to integer[].

2011/7/20, Ivan Polak :
> Hi,
>
> in postgreSQL (with LTREE extension) database I have the following
> table "comments":
>
> id BIGINT /* id */
> article_id BIGINT /*article-id */
> parent_id BIGINT
> comment TEXT
> path LTREE
> level INTEGER /* level */
>
> with the following rows:
>
> id article_id comment parent_id path level
> 1 1  1 1
> 2 1  1 1.2 2
> 3 1  2 1.2.3 3
> 4 1  2 1.4 2
> 5 1  4 1.4.5 3
> 6 1  6 1
> 7 1  6 6.7 2
> 8 1  6 6.8 2
> 9 1  9 1
> 10 1  10 1
> 11 1  5 1.4.5.11 4
>
> and I need to select complete tree (with correct order of comments).
>
> SELECT * from comments where article_id = 2 order by 
>
> when I used:
>
> SELECT * from comments where article_id = 2 order by path
>
> the result is:
>
> id comment path
> 1  1
> 2  1.2
> 3  1.2.3
> 4  1.4
> 5  1.4.5
> 11  1.4.5.11
> 10  10
> 6  6
> 7  6.7
> 8  6.8
> 9  9
>
> BUT, it is wrong, because comment with id = 10 is after comment with id=11
>
> (i know, this is correct, because ordering by column PATH [as TEXT],
> and 10 is 'after' 1.4.5.11)
>
> , but I need :
>
> id comment path
> 1  1
> 2  1.2
> 3  1.2.3
> 4  1.4
> 5  1.4.5
> 11  1.4.5.11
> 6  6
> 7  6.7
> 8  6.8
> 9  9
> 10  10
>
> thanks
>
> Ivan
>
> --
> Sent via pgsql-sql mailing list ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>


-- 

pasman

-- 
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql