[SQL] Table History

2004-12-16 Thread Richard Sydney-Smith
times and I wonder if a general purpose trigger exists or if not then can someone point me to an example set of triggers?   I would like to trace an action code "Edit" or "Delete" in FTRANS_IMAGE in additional to the common fields.   thanks muchly   Richard Sydney-Smith

[SQL] Installation woes

2004-10-18 Thread Richard Sydney-Smith
sgresql is not "normally" a enduser software product. It has been designed as an industrial strength RDBMS for installation by professionals. In that environment it excells. I will lookforward to hearing how others are tackling the "embedded install".   best regards   Richard

[SQL] Test for file exists?

2004-09-19 Thread Richard Sydney-Smith
I want to use pgsql to send the command: Copy sometable from 'sometable.csv'; But only if 'sometable.csv' exists; If 'sometable.csv' does not exist as an input table I want to continue the next command. My full procedure is as follows and any help is greatly appreciated. Thanks Richard CREAT

Re: [SQL] Implementation of a bag pattern using rules

2004-02-09 Thread Richard Sydney-Smith
ked a solutions where both the abs and relative inserts apply to the same bag eg insert another apple vs set apples to 5 Much of my attitude to triggers has been non-committal. Your example changes that. Well thanks again Richard Sydney-Smith - Original Message - From: "Mark Gibso

Re: [SQL] Slow sub-selects, max and count(*)

2004-02-05 Thread Richard Sydney-Smith
Thanks Josh and Ian,   narrowing the problem down. The really slow line is the one where I try and remove potential duplicates. It does not look at the indexes.   Point on using copy rather than insert is taken. I use copy to load to a temp file so I can test the data and alter certain value

[SQL] Slow sub-selects, max and count(*)

2004-02-04 Thread Richard Sydney-Smith
minutes to insert a day is really too slow. Each days import table contains about 3200 records. Total table size for fsechist is about 2.5 million records.     If you could point me in the right direction here it would be much appreciated.   thanks   Richard Sydney-Smith

[SQL] Ooops ! :( Recovery techniques

2003-11-30 Thread Richard Sydney-Smith
-index and keep going. I that possible with postgres of do I have to do a full rebuild?   thanks verymuch   Richard Sydney-Smith

[SQL] Mystery function error

2003-09-27 Thread Richard Sydney-Smith
As I am converting from Sybase I wanted to create a function which would replicate the behaviour of the sybase "Locate" command.   The goal is to have   locate( stra, strb) = position(strb in stra)   where "position" is the standard postgres function for the index position of string "A" in

[SQL] Date interval

2003-09-25 Thread Richard Sydney-Smith
I am looking for a way to convert an interval into a number of days ( integer);   In sybase I would use :   days(today()-r_expire)   where r_expire is the timestamp I am comparing against.   How do we do this in postgres?   date_trunc(today()-r_expire) does not seem to do it   thanks   Richa

[SQL] DBschema restore

2003-09-19 Thread Richard Sydney-Smith
An example problem...The dbschema file contains the following section ( which causes several errors)-- Function: public.today()CREATE FUNCTION public.today() RETURNS date AS 'select current_date;'  LANGUAGE 'sql' VOLATILE;-- View: public.todayCREATE VIEW public.today AS SELECT today() A

[SQL] restoring dbschema

2003-09-19 Thread Richard Sydney-Smith
I have a database created with pg 7.3.1 In pgAdminII I have saved the DBSchema   After creating a  new database in pgAdmin I opened a SQL box and loaded the dbschema.sql file and tried to run  it.   A number of errors occured. The first was that the public namespace was already defined this

[SQL] Copy Command Error

2003-09-15 Thread Richard Sydney-Smith
I am outputting the following rows from a SYBASE database on W2000   3 '2' 'IBISFinancials' 'A.C.N. 072 378 815'8 'RK' 'Personal Accounts'    Using the command:   select cast(seq as integer) , id , cmpy, tr_n from fcont; output to d:\fcont.dat format 'ascii' delimited by '\x09'   This output

[SQL] Use derived expression in select statement

2003-09-13 Thread Richard Sydney-Smith
I am converting a database from Sybase and have found the following command does not work in the same fashion. select dy_c , dy_sect as tsect, (cy_bfwd + dy_p1T4) as curr_bal from fclitot where dy_yr = 0 and (curr_bal) <-0.005 In the actual command used curr_bal is calculated from a very much lon

Re: [SQL] How do I replace select ... into commands?

2003-09-11 Thread Richard Sydney-Smith
Thanks that fixed it. the more I use it the happier I get with postgresql. Best Regards Richard - Original Message - From: "Tom Lane" <[EMAIL PROTECTED]> To: "Richard Sydney-Smith" <[EMAIL PROTECTED]> Cc: "Stephan Szabo" <[EMAIL

Re: [SQL] How do I replace select ... into commands?

2003-09-11 Thread Richard Sydney-Smith
s we have just used update fseqkeys set seq_val = rsn where seq_key=tbl; -- now return the RSN number to the user return rsn; end; ' LANGUAGE 'plpgsql' VOLATILE; - Original Message - From: "Stephan Szabo" <[EMAIL PROTECTED]> To: "Richard Sydney-Smith&qu

[SQL] How do I replace select ... into commands?

2003-09-11 Thread Richard Sydney-Smith
offered in plpgsql?   much thanks for the earlier help.   Sincerely Richard Sydney-Smith  

[SQL] how to vacum

2003-09-10 Thread Richard Sydney-Smith
Tried to issue the command "vacum full" both from psql and the sql box in pgadmin without success.   How do you use the command?   select vacum full;   also does not work   Lost in the woods please help   Richard  

[SQL] Conversion from Sybase ASA

2003-09-09 Thread Richard Sydney-Smith
In sybase I can use the following syntax:   select 'T' as src,(if tbon is null or tbon < '1900/12/12' or tbon > '1900/9/30' then 'U' else 'P' endif) as pres from ftrans this returns two columns: src = '' and pres which has either the value 'U' or 'P' how would I express this in postgresql