[GENERAL] Good candidate query for window syntax?

2010-09-10 Thread Ketema Harris
Hello, I have a table defined as: CREATE TABLE demo AS ( id serial PRIMARY KEY, start_time timestamp without timezone, duration integer ) A sample data set I am working with is: start_time | duration | end_time

Re: [GENERAL] Good candidate query for window syntax?

2010-09-10 Thread Ketema
On Sep 10, 9:08 am, jgo...@gmail.com (Jorge Godoy) wrote: Have you checked the OVERLAPS operator in the documentation? http://www.postgresql.org/docs/8.4/interactive/functions-datetime.html -- Jorge Godoy     jgo...@gmail.com On Fri, Sep 10, 2010 at 10:03, Ketema Harris ket...@gmail.com

Re: [GENERAL] Good candidate query for window syntax?

2010-09-10 Thread Ketema Harris
On Fri, Sep 10, 2010 at 9:40 AM, Ketema ket...@gmail.com wrote: On Sep 10, 9:08 am, jgo...@gmail.com (Jorge Godoy) wrote: Have you checked the OVERLAPS operator in the documentation? http://www.postgresql.org/docs/8.4/interactive/functions-datetime.html -- Jorge Godoy jgo

Re: [GENERAL] could you tell me this..?

2010-08-05 Thread Ketema Harris
Never kill -9. Use kill -INT, whatever signal num that is, 11? Sent from my iPhone On Aug 5, 2010, at 3:14 AM, 백승엽 syb...@seriends.com wrote: Hi. I am korean database engineer. my english skill is very poor. but i desire that you teach this situation. um... I am

Re: [GENERAL] [PHP] Some undefined function errors

2010-05-20 Thread Ketema Harris
pg_encoding_to_char If you see these thigns set to NO even after PostgreSQL support says yes, then you know you wont be getting all the functions. Ketema J. Harris ket...@ketema.net ket...@jabber.ketema.net (Jabber) http://www.ketema.net ket...@voip.ketema.net - VoIP 407-459-4809- main

[GENERAL] Grouping Question

2009-07-31 Thread Ketema Harris
I have a table defined as CREATE TABLE mytable ( carrier varchar, start_time timestamp with time zone, call_date date, cost numeric, call_length numeric ) I want to create a query that will generate a the following columns: carrier, week, sum(call_length) as totallength, sum(cost) as

Re: [GENERAL] Grouping Question

2009-07-31 Thread Ketema Harris
don't get merged together Ketema Harris wrote: I have a table defined as CREATE TABLE mytable ( carrier varchar, start_time timestamp with time zone, call_date date, cost numeric, call_length numeric ) I want to create a query that will generate a the following columns: carrier, week, sum

Re: [GENERAL] Why I cannot call a function from within an SQL function?

2009-02-20 Thread Ketema Harris
Use dollar quoting around your fiction body I'd double up on the single quotes around the dash Sent from my iPhone On Feb 20, 2009, at 8:14 AM, Eus e...@member.fsf.org wrote: Hi Ho! Sorry, let me revise the query a bit. I copied and pasted the original one from another big query. ---

[GENERAL] unable to assign value to composite column in trigger

2008-12-18 Thread Ketema Harris
at or near ( I have tried removing the () and it fails with syntax error at or near new non composite column can be assigned to in the trigger just fine: new.other_columm := 5; --gives no issues How can a composite column be assigned to inside a trigger? Thanks Ketema J. Harris www.ketema.net

Re: [GENERAL] unable to assign value to composite column in trigger

2008-12-18 Thread Ketema Harris
On Dec 18, 2008, at 4:19 PM, Ketema Harris wrote: The following is a snippet from a trigger i am using: _mycompositeType.user_id = (OLD).mycompositeType.user_id; ...do some stuff... --notice that assigning from the trigger record works but later on... (new).mycompositeType.transaction_id

[GENERAL] Composite type evaluates to Null if any element is null

2008-12-17 Thread Ketema Harris
, but not null. Thanks for the feedback. Ketema J. Harris www.ketema.net ket...@ketema.net ketemaj on iChat -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Trigger/Rules Order of operations

2008-12-16 Thread Ketema
On Dec 16, 10:31 am, Ivan Pavlov ivan.pav...@gmail.com wrote: I can't answer your question but I think you may have a serious database design issue at hand. Why not try to accomplish your goals in a simpler way? Regards, Ivan Pavlov On Dec 15, 12:49 pm, ket...@ketema.net (Ketema Harris

Re: [GENERAL] View vs Constantly Updated Table

2008-12-16 Thread Ketema Harris
How often are you using the bank balance value? I have no data on this as of yet, but it obviously needs to be correct for when the user looks at it. The opposite argument, is how long does the computation take? The computation is simple, however the amount of data that goes into it

[GENERAL] View vs Constantly Updated Table

2008-12-15 Thread Ketema Harris
in the end select balance from view or select balance from table ? What are the pros cons ? Thanks Ketema J. Harris www.ketema.net ket...@ketema.net ketemaj on iChat inline: kmail.png -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription

[GENERAL] Trigger/Rules Order of operations

2008-12-15 Thread Ketema Harris
not an endless loop) Table A will have its Before Trig fire again and this time the criteria causes it to finish with a return new. Will the second insert into table A commit before the first insert into table A? What order does the insert into table B finish up? Ketema J. Harris www.ketema.net

Re: [GENERAL] View vs Constantly Updated Table

2008-12-15 Thread Ketema
On Dec 15, 11:25 am, r...@iol.ie (Raymond O'Donnell) wrote: On 15/12/2008 16:14, Ketema Harris wrote: if i have a column that is a calculation, say a bank balance - sum of all the debits and credits...is it more efficient to make a view that executes the underlying calc query doing

[GENERAL] Inherited FK Indexing

2007-09-14 Thread Ketema Harris
I have the following table set up: CREATE TABLE states ( state_id integer NOT NULL DEFAULT nextval ('state_province_id_seq'::regclass), state character(2), full_name character varying, timezone character varying, CONSTRAINT PK_state_id PRIMARY KEY (state_id) ) CREATE TABLE

[GENERAL] pg_dumpall to psql -f NOT working

2007-08-12 Thread Ketema
Hello. I performed a pg_dumpall of my 8.1 db cluster and upgraded to 8.2.4. the dump went fine and the script file appears to be fine. I have a mixture of UTF8 and SQL_ASCII databases in the dump. However I am not able to restore my data after the upgrade. I performed from the command line

Re: [GENERAL] multidimensional arrays

2007-05-02 Thread Ketema
On May 1, 10:48 pm, [EMAIL PROTECTED] (Tom Lane) wrote: Ketema [EMAIL PROTECTED] writes: Is it possible to access a subarray of a multi dimensional array as a whole? I think you want an array slice (ie, something with some colons in the subscripts). See the manual:http

[GENERAL] multidimensional arrays

2007-05-01 Thread Ketema
Is it possible to access a subarray of a multi dimensional array as a whole? example: '{ { {1,2,3}, {11,22,33}, {111,222,333} }, { {4,5,6}, {44,55,66}, {444,555,666} }, { {7,8,9}, {77,88,99}, {777,888,999}

[GENERAL] where clause help

2007-04-23 Thread Ketema
i have a record set like below: num_prods|num_open_issues|num_provisioned|num_canceled 1|0|1|0 2|0|0|2 3|0|1|1 2|0|1|1 1|0|01 2|0|0|0 3|3|0|0 3|0|0|3 3|1|0|2 3|2|0|1 2|0|2|0 Of the list above only row 3 and row 6 should be returned. Plain english definition: With a result set like above

Re: [GENERAL] where clause help

2007-04-23 Thread Ketema
Man so simple! is your solution the same as: num_provisioned num_products AND (num_open_issues + num_provisioned + num_canceled) num_prods which is what i finally came up with ---(end of broadcast)--- TIP 5: don't forget to increase your

Re: [GENERAL] Dynamic DDL

2007-04-17 Thread Ketema
On Apr 16, 6:24 pm, [EMAIL PROTECTED] (Tom Lane) wrote: Ketema [EMAIL PROTECTED] writes: I have an example were I have to build a string in the below manner: values (' || new.tpv_success_id || ',''' || new.order_date || ''',' || new.tpv_id || ',' || new.ver_code || ',''' || new.agent_name

Re: [GENERAL] Dynamic DDL

2007-04-17 Thread Ketema
On Apr 17, 11:19 am, Ketema [EMAIL PROTECTED] wrote: On Apr 17, 7:35 am, Ketema [EMAIL PROTECTED] wrote: On Apr 16, 6:24 pm, [EMAIL PROTECTED] (Tom Lane) wrote: Ketema [EMAIL PROTECTED] writes: I have an example were I have to build a string in the below manner: values

Re: [GENERAL] Dynamic DDL

2007-04-17 Thread Ketema
On Apr 17, 7:35 am, Ketema [EMAIL PROTECTED] wrote: On Apr 16, 6:24 pm, [EMAIL PROTECTED] (Tom Lane) wrote: Ketema [EMAIL PROTECTED] writes: I have an example were I have to build a string in the below manner: values (' || new.tpv_success_id || ',''' || new.order_date

[GENERAL] Dynamic DDL

2007-04-16 Thread Ketema
create or replace function schema.insert_function(_schema text, _table text) returns integer as $BODY$ declare _affected integer; begin set search_path to _schema; insert into _table (columns) values(vals); return 0; end; $BODY$ language plpgsql; is there any whay to get

Re: [GENERAL] Dynamic DDL

2007-04-16 Thread Ketema
On Apr 16, 4:47 pm, [EMAIL PROTECTED] (Martijn van Oosterhout) wrote: On Mon, Apr 16, 2007 at 01:37:43PM -0700, Ketema wrote: create or replace function schema.insert_function(_schema text, _table text) returns integer snip set search_path to _schema; insert into _table (columns

[GENERAL] Select permissions on System tables

2006-11-02 Thread Ketema
I created a view as: CREATE OR REPLACE VIEW caviar_schemas AS SELECT n.oid::integer AS schema_id, n.nspname::information_schema.sql_identifier::text AS schema_name FROM pg_namespace n, pg_authid u WHERE n.nspowner = u.oid AND pg_has_role(n.nspowner, 'MEMBER'::text) AND

Re: [GENERAL] Catch multiple records when doing Select Into

2006-11-02 Thread Ketema
It would be easier if we could see the context in which you are doing the select into. However I think this may help. Try putting the select into in a loop: declare _result record; _rows integer; begin _rows := 0; for _result in select statement here loop in here

[GENERAL] Best Data type for Binary Data?

2006-01-05 Thread Ketema Harris
Hi, I would like to store binary data from a tcpdump (libpcap) file in a table. What is the best type to use? i have read posts saying lo, oid, and bytea. Which one would be best for this scenario?Thanks, ketema