Re: [SQL] Postgres MD5 Function

2003-02-02 Thread David Durst
Is there anywhere I can get these in binary? Or is my only option to compile Postgres from source?? Larry Rosenman wrote: --On Friday, January 31, 2003 01:34:42 -0800 David Durst [EMAIL PROTECTED] wrote: Does there exsist a MD5 Function I can call??? look at /contrib/pgcrypto in the source

[SQL] Question about passing User defined types to functions

2003-01-30 Thread David Durst
is there a example on how to pass user defined types into a function?? What I am looking for is something of this nature. CREATE TYPE dumby_type AS (dumby_id int4, dumby_name text); create function kick_dumby(dumby dumby_type) returns INTEGER AS ' DECLARE somenumber integer; BEGIN return 1;

Re: [SQL] LONG - Question on dealing w/ numerics

2003-01-29 Thread David Durst
David Durst [EMAIL PROTECTED] writes: insert into journal_lines (entry_id,account_id,line_type,line_amount) values (eid,aid,ltype,amount); select into line * from journal_lines where entry_id = eid AND account_id = aid AND ltype = ltype; I bet that last should be line_type = ltype

[SQL] LONG - Question on dealing w/ numerics

2003-01-28 Thread David Durst
I have a function that is to create a Accounting JOURNAL entry. The strange thing is the function works for simple entries such as: Cash - Debit 100 A/R - Credit 100 But when I try to trick it or break it for testing purposes (IT DOES BREAK WHEN IT SHOULDN'T) on a entry like this: Cash -

[SQL] ERROR: Cannot display a value of type RECORD

2003-01-26 Thread David Durst
I recieve this error when executing the following function: select lookup_journal_entries(to_date('20030125','MMDD'), to_date('20030125','MMDD')); Here is the function itself: create function lookup_journal_entries(date,date) returns setof journal as '

Re: [SQL] ERROR: Cannot display a value of type RECORD

2003-01-26 Thread David Durst
I figured out the issue, DH stupid mistake select entry_id, entry_description from lookup_journal_entries(to_date('20030125','MMDD'), to_date('20030125','MMDD')); I recieve this error when executing the following function: select

Re: [SQL] Scheduling Events?

2003-01-24 Thread David Durst
here is a possible NON-Cron solution that a friend of mine came up w/ 1) Create a table w/ scheduled events and Account Ids attached to them. 2) Create a table w/ temporal event execution timestamps. 3) On journal entry check to see if there any schedule events for the Account 4) Check timestamp

[SQL] Function for adding Money type

2003-01-24 Thread David Durst
Are there functions for adding and subtracting this type from itself? Or is there a simple way to do it? ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] Function for adding Money type

2003-01-24 Thread David Durst
David, Are there functions for adding and subtracting this type from itself? Or is there a simple way to do it? The MONEY type is depreciated, and should have been removed from the Postgres source but was missed as an oversight. Use NUMERIC instead. -- -Josh Berkus Aglio Database

[SQL] NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index

2003-01-22 Thread David Durst
Can anyone tell me why postgres is creating a implicit index when I already have a PKEY specified Or am I just interpreting this all wrong? Here is the entry I am putting in: create sequence journal_line_id_seq increment 1 start 1; create table journal_lines ( journal_line_id int4

[SQL] returning setof in plpgsql

2003-01-21 Thread David Durst
I have a function that I want to return setof a table in plpgsql. Here is what I have: CREATE FUNCTION lookup_account(varchar(32)) RETURNS SETOF accounts AS ' DECLARE aname ALIAS FOR $1; rec RECORD; BEGIN select into rec * from accounts where accountname = aname; return rec; END;'

[SQL] Returning row or rows from function?

2003-01-13 Thread David Durst
I want to create a function that will return a row or rows of a table is this possible? If so can someone replay with a complete example? ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send

[SQL] Insert Function

2002-07-10 Thread David Durst
declared to return integer, but final statement is not a SELECT I thought that a insert would return a internal row #, but I am not sure about this. Thanks, David Durst MIS Manager www.la-rubber.com ---(end of broadcast)--- TIP 4: Don't 'kill -9

[SQL] Returning rows from functions

2002-07-10 Thread David Durst
I was wondering if there was a way of returning a complete row from a function, in reading the documentation of CREATE FUNCTION. I was under the impression that you could return a row by using setof, but this does not seem to be true. Can anyone help? ---(end of