[GENERAL] max() question

1999-09-14 Thread Hitesh Patel

I have a table with and email address and a datetime timestamp.  What
would be the easiest way to select the 3 earliest timestamps (earliest
being furthest in the past from the current date)





Re: [GENERAL] logging/Accounting from Radiusd ?

1999-09-16 Thread Hitesh Patel

Holm Tiffe wrote:
> 
> Hi,
> 
> there are several rumors about logging from radiusd to pgsql in this list;
> my question is now, has anyone already done that ?
> 
> We wish to do our accounting from an Ascend Max and the authorisation with
> postgresql, and I don't want to reinvent a wheel.
> 
> If so, are the changes to radiusd publically available ?
> 
> Holm
> --
> FreibergNet Systemhaus GbR  Holm Tiffe  * Administration, Development
> Systemhaus für Daten- und Netzwerktechnik   phone +49 3731 781279
> Unternehmensgruppe Liebscher & Partnerfax +49 3731 781377
> D-09599 Freiberg * Am St. Niclas Schacht 13http://www.freibergnet.de/
> 
> 
Go look at the patches section of Cistron Radius.  I have been using
this in a production environment with both authentication and accouting
going to postgres.  I believe the patch there is sufficient, i have made
a lot of custom tweaks and maybe after cleaning things up will release
it to the tigers :-)

http://www.miquels.cistron.nl/radius/

-- 
|-----||
| Hitesh Patel|  Voice: (541) 759-3126 |
| Facilities Development Manager  |  Fax:   (541) 759-3214 |
| Preferred Systems   |  Email: [EMAIL PROTECTED]  |
|-||





[GENERAL] weird sum() results

2000-01-19 Thread Hitesh Patel

I have a table with a filed named 'amount' and all the values are
positive values, but if i do this:

select sum(amount) from table where state = 'CA';

I get a negative number.  Doing a

select name, amount from table where state = 'CA' and amount < '0';

Returns 0 rows.  Any ideas as to why i'm getting a negative value for
the sum()?





Re: [GENERAL] weird sum() results

2000-01-20 Thread Hitesh Patel

 I can understand that.  What's weird is that I can do a sum(amount) on
 the whole table and the value comes out to only My only problem is that
 the amount field is the money type and doesn't like the casting now.  A
 
 SELECT SUM(amount::float8) FROM table where state = 'CA';
 
 returns
 
 ERROR: No such function 'float8' with the specified attributes
 
 And again i'm stuck :-)
 
 Thanks in advance for any help.
-- 
|-----|--------|
| Hitesh Patel|  Voice: (541) 759-3126 |
| Facilities Development Manager  |  Fax:   (541) 759-3214 |
| Preferred Systems   |  Email: [EMAIL PROTECTED]  |
|-||





[GENERAL] Need help creating a function

2000-02-03 Thread Hitesh Patel

Does anyone have a function laying around that convert a 'money' type to
a float8 and return it?





[GENERAL] textpos() function

2000-05-09 Thread Hitesh Patel

I just upgraded to postgresql 7.0 and was restoring my data when I
noticed I had a function defined that used the builtin textpos()
function.  This function was available in 6.5.3 but seems to have
dissapeared in 7.0..  Is there any way to restore this function or has
it been renamed to something else (i found strpos() but i'm not sure if
that does exactly the same thing).  

-- 
|-|----|
| Hitesh Patel|  Voice: (541) 759-3126 |
| |  Fax:   (541) 759-3214 |
| Preferred Communications Inc.   |  Email: [EMAIL PROTECTED] |
|-||



Re: [GENERAL] textpos() function

2000-05-10 Thread Hitesh Patel

Tom Lane wrote:
> 
\> Looks like it's called position() now --- that function has the same
OID
> (849) as 6.5's textpos(), and even more damningly points to a C function
> that's still called textpos():
> 
> regression=# select oid,* from pg_proc where oid=849;
>  oid | proname  | proowner | prolang | proisinh | proistrusted | proiscachable |
>  pronargs | proretset | prorettype | proargtypes | probyte_pct | properbyte_cpu
> | propercall_cpu | prooutin_ratio | prosrc  | probin
> -+--+--+-+--+--+---+
> --+---++-+-+
> +++-+
>  849 | position |  256 |  11 | f| t| t |
> 2 | f | 23 |   25 25 | 100 |  0
> |  1 |  0 | textpos | -
> (1 row)
> 
> We've made a number of changes in 7.0 to bring function and type names
> into alignment with the SQL92 standard.  The incompatibilities I knew
> about were in date/time types and functions, but I guess this is another
> one ...
> 
> If you really don't want to update your app's code just yet, you can
> install a pg_proc entry that defines textpos() with a CREATE FUNCTION
> command.  But the long-term answer is to fix your code to conform with
> the standard.
> 
> regards, tom lane

I changed my code to use position() instead of textpos(), the only
problem is that I now get a parse error at the following line:

i:= position(stringa, ',');

The exact error message is:

ERROR: parser: parse error at or near "," 

Trying to run a query like, 'select position(email, ',') from table'
fails with the same parse error, however 'select strpos(email, ',') from
table' runs fine...

any hints?

-- 
|-||
| Hitesh Patel|  Voice: (541) 759-3126 |
| Facilities Development Manager  |  Fax:   (541) 759-3214 |
| Preferred Systems   |  Email: [EMAIL PROTECTED]  |
|-||