Re: [HACKERS] to_char incompatibility

2008-01-17 Thread Brendan Jurd
On Jan 17, 2008 8:22 AM, Bruce Momjian <[EMAIL PROTECTED]> wrote: > Andrew Dunstan wrote: > > Tom Lane wrote: > > > Peter Eisentraut <[EMAIL PROTECTED]> writes: > > > > > >> A further example shows that to_date seems to have little error checking > > >> altogether: > > TODO list item? > > We have

Re: [HACKERS] to_char incompatibility

2008-01-16 Thread Bruce Momjian
Peter Eisentraut wrote: > Am Donnerstag, 10. Januar 2008 schrieb Roberts, Jon: > > > On PostgreSQL: > > > > > > select to_date('31-DEC-200700:00:00', 'dd-mon- hh24:mi:ss'); > > >to_date > > > -- > > > 200700-12-31 > > > Oracle removes all white spaces in the date you pass in a

Re: [HACKERS] to_char incompatibility

2008-01-16 Thread Bruce Momjian
Andrew Dunstan wrote: > > > Tom Lane wrote: > > Peter Eisentraut <[EMAIL PROTECTED]> writes: > > > >> A further example shows that to_date seems to have little error checking > >> altogether: > >> > > > > Yeah, that's been one of the main knocks on that code since day one. > > Somebody n

Re: [HACKERS] to_char incompatibility

2008-01-16 Thread Andrew Dunstan
Tom Lane wrote: Peter Eisentraut <[EMAIL PROTECTED]> writes: A further example shows that to_date seems to have little error checking altogether: Yeah, that's been one of the main knocks on that code since day one. Somebody needs to spend a whole lot of time on it, and the original a

Re: [HACKERS] to_char incompatibility

2008-01-16 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > A further example shows that to_date seems to have little error checking > altogether: Yeah, that's been one of the main knocks on that code since day one. Somebody needs to spend a whole lot of time on it, and the original author has left the projec

Re: [HACKERS] to_char incompatibility

2008-01-16 Thread Peter Eisentraut
Am Donnerstag, 10. Januar 2008 schrieb Roberts, Jon: > > On PostgreSQL: > > > > select to_date('31-DEC-200700:00:00', 'dd-mon- hh24:mi:ss'); > >to_date > > -- > > 200700-12-31 > Oracle removes all white spaces in the date you pass in and the date > format. I don't have a stro

Re: [HACKERS] to_char incompatibility

2008-01-14 Thread Gregory Stark
"Tom Lane" <[EMAIL PROTECTED]> writes: > Josh Berkus <[EMAIL PROTECTED]> writes: >> Security Definer has ramifications in PostgreSQL which I don't think it >> does in Oracle. Particularly, see: >> http://www.postgresql.org/docs/techdocs.77 > > BTW, that article needs to be updated to show the (

Re: [HACKERS] to_char incompatibility

2008-01-14 Thread Tom Lane
Josh Berkus <[EMAIL PROTECTED]> writes: > Security Definer has ramifications in PostgreSQL which I don't think it > does in Oracle. Particularly, see: > http://www.postgresql.org/docs/techdocs.77 BTW, that article needs to be updated to show the (much easier) way to do it as of 8.3. I concur t

Re: [HACKERS] to_char incompatibility

2008-01-14 Thread Josh Berkus
Jon, > Also, there is no need to argue this because we can have it both ways. > Security definer is an option and I recommend to always use it over the > default. If you don't want to use it, don't. Security Definer has ramifications in PostgreSQL which I don't think it does in Oracle. Particu

Re: [HACKERS] to_char incompatibility

2008-01-14 Thread Roberts, Jon
> > You'll have to explain to Oracle and their customers that Oracle's > > security model is not a great idea then. > > I'd love to, and in fact *do* whenever I'm given the chance. > > In fact, Oracle's security model is pretty bad; the reason why Oracle > advertises "Unbreakable" so hard is th

Re: [HACKERS] to_char incompatibility

2008-01-14 Thread Josh Berkus
Jon, > You'll have to explain to Oracle and their customers that Oracle's > security model is not a great idea then. I'd love to, and in fact *do* whenever I'm given the chance. In fact, Oracle's security model is pretty bad; the reason why Oracle advertises "Unbreakable" so hard is that they

Re: [HACKERS] to_char incompatibility

2008-01-10 Thread Tom Lane
"Roberts, Jon" <[EMAIL PROTECTED]> writes: > > Executing a function should never require privileges on the underlying > objects referenced in it. The function should always run with the rights of > the owner of the function, not the user executing it. > You might want to climb off that soapbox

Re: [HACKERS] to_char incompatibility

2008-01-10 Thread Roberts, Jon
> > Jon, > > > I always put security definer as I really think that should be the > > default behavior. Anyway, your function should run faster. > > That's not a real good idea. A security definer function is like an SUID > shell script; only to be used with great care. > You'll have to expl

Re: [HACKERS] to_char incompatibility

2008-01-10 Thread Josh Berkus
Jon, > I always put security definer as I really think that should be the > default behavior. Anyway, your function should run faster. That's not a real good idea. A security definer function is like an SUID shell script; only to be used with great care. -- --Josh Josh Berkus PostgreSQL @ S

Re: [HACKERS] to_char incompatibility

2008-01-10 Thread Roberts, Jon
eter Eisentraut; pgsql-hackers@postgresql.org > Subject: Re: [HACKERS] to_char incompatibility > > small non important note: your function is very expensive > > exactly same but faster is: > > CREATE OR REPLACE FUNCTION fn_to_date(p_date varchar, p_format varchar) > RETURNS

Re: [HACKERS] to_char incompatibility

2008-01-10 Thread Pavel Stehule
small non important note: your function is very expensive exactly same but faster is: CREATE OR REPLACE FUNCTION fn_to_date(p_date varchar, p_format varchar) RETURNS timestamp AS $$ SELECT to_timestamp(replace($1, ' ', ''), replace($2, ' ', '')); $$ LANGUAGE SQL STRICT IMMUTABLE; or CREATE OR

Re: [HACKERS] to_char incompatibility

2008-01-10 Thread Roberts, Jon
> -Original Message- > On Oracle: > > SQL> select to_date('31-DEC-200700:00:00', 'dd-mon- hh24:mi:ss') from > dual; > > TO_DATE(' > - > 31-DEC-07 > > On PostgreSQL: > > select to_date('31-DEC-200700:00:00', 'dd-mon- hh24:mi:ss'); >to_date > -- > 200700-