Skip site navigation (1) Skip section navigation (2)

Using a User-Def function in a query

From: Ralph Smith <smithrn(at)washington(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Using a User-Def function in a query
Date: 2008-09-24 00:53:30
Message-ID: BC99B94A-40B2-463D-89AD-29847263D28E@washington.edu (view raw or flat)
Thread:
Lists: pgsql-general
I've written several user-defined functions (UDFs) for converting  
dates to unix time, every which way.
They work find, ala

     # select dtu_dmony('22 Sep 2008');
      dtu_dmony
     ------------
      1222066800
     (1 row)
Returns an integer.

---
Here's a typical query I often run (why I wrote the functions
     # select count(distinct username) from stats where eventtime >  
1222066800 ;
      count
     -------
       1460
     (1 row)

---
but when I try to use the function in a query
     # select count(distinct username) from stats where eventtime >  
dtu_dmony('22 Sep 2008') ;
it never comes back...

---
Is it the table-like formatting that's killing me?
How do I get around this?

Thanks!

Ralph Smith
smithrn at here washington.edu
=====================



Responses

pgsql-general by date

Next:From: Craig RingerDate: 2008-09-24 01:02:20
Subject: Re: pg_dump | pg_sql: insert commands and foreign key constraints
Previous:From: Andrew SullivanDate: 2008-09-24 00:49:25
Subject: Re: Slony vs Longiste

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group