[SQL] Commenting PLPGSQL

2003-02-03 Thread David Durst
Is it possible to have comment lines inside PLPGSQL?? ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing li

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??? &

[SQL] Postgres MD5 Function

2003-01-31 Thread David Durst
Does there exsist a MD5 Function I can call??? If not, is there any interest in one? ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

[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

[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 - Debit

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 lookup_journal_entries(to_

[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 ' selec

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

[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] 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 t

Re: [SQL] Scheduling Events?

2003-01-24 Thread David Durst
> On Thu, 23 Jan 2003, David Durst wrote: > >> Is there anyway to schedule DB Events based on time? > > Yes! cron > >> So lets say I had a table w/ depreciation schedules in it, >> I would like the DB to apply the formula and make the entries on the >> EN

Re: [SQL] Scheduling Events?

2003-01-23 Thread David Durst
On a side note, if the DB doesn't support this capability. Does anyone see a HORRIBLE issue w/ creating a C func something of this nature. int handle_temporal_events() { if(fork == 0) { //In here we monitor what time it is //And maintain a Datastructure w/ events //And update it eve

[SQL] Scheduling Events?

2003-01-23 Thread David Durst
Is there anyway to schedule DB Events based on time? So lets say I had a table w/ depreciation schedules in it, I would like the DB to apply the formula and make the entries on the END of every month. ---(end of broadcast)--- TIP 3: if posting/read

[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 PRIMARY

[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;' LANGUAG

[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 "unre

[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 broadcas

[SQL] Insert Function

2002-07-10 Thread David Durst
t: ERROR: function 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: