Re: [GENERAL] Application locking

2013-06-28 Thread Kenneth Tilton
Sorry, big typo below: On Fri, Jun 28, 2013 at 1:16 PM, Kenneth Tilton wrote: > We want to make sure no two examiners are working on the same case at the > same time, where the cases are found by searching on certain criteria with > limit 1 to get the "next case". > >

[GENERAL] Application locking

2013-06-28 Thread Kenneth Tilton
er_id, 'started-editing', clm_id from nc returning oint locked) select locked from ic limit 1 into locked_id; return locked_id; If I am all wet, is their a reliable way to achieve this? Thx, kt -- Kenneth Tilton *Director of Software Development* *MCNA Dental Plans* 200 West Cypress

Re: [GENERAL] Swapping volumes under tablespaces: supported?

2013-02-10 Thread Kenneth Tilton
tion: > http://www.postgresql.org/**mailpref/pgsql-general<http://www.postgresql.org/mailpref/pgsql-general> > -- Kenneth Tilton *Director of Software Development* *MCNA Dental Plans* 200 West Cypress Creek Road Suite 500 Fort Lauderdale, FL 33309 954-730-7131 X181 (Office) 954-628-3347 (Fa

[GENERAL] Swapping volumes under tablespaces: supported?

2013-02-08 Thread Kenneth Tilton
thing. -- Kenneth Tilton *Director of Software Development* *MCNA Dental Plans* 200 West Cypress Creek Road Suite 500 Fort Lauderdale, FL 33309 954-730-7131 X181 (Office) 954-628-3347 (Fax) 1-800-494-6262 X181 (Toll Free) ktil...@mcna.net (Email) www.mcna.net (Website) CONFIDENTIALITY NOTICE:

Re: [GENERAL] How get column-wise table info from an arbitrary query?

2012-12-04 Thread Kenneth Tilton
On Tue, Dec 4, 2012 at 8:26 PM, Raymond O'Donnell wrote: > On 05/12/2012 01:11, Raymond O'Donnell wrote: > > On 05/12/2012 01:04, Kenneth Tilton wrote: > >> I am porting from MySQL some code that has to take an arbitrary query > >> involving joins and build

[GENERAL] How get column-wise table info from an arbitrary query?

2012-12-04 Thread Kenneth Tilton
h we follow anyway), but if Postgres itself offers this it would be that much cleaner. So: Is there any way on an arbitrary query to determine column names qualified by table aliases? Thx, kt -- Kenneth Tilton *Director of Software Development* *MCNA Dental Plans* 200 West Cypress Creek Road Suit

Re: [GENERAL] database error xx000?

2012-04-26 Thread Kenneth Tilton
On Thu, Apr 26, 2012 at 3:07 PM, dennis jenkins wrote: > On Thu, Apr 26, 2012 at 1:59 PM, Kenneth Tilton wrote: > >> On Thu, Apr 26, 2012 at 2:24 PM, Tom Lane wrote: >> >> >>> Can you produce a self-contained test case? >>> >> >> I

Re: [GENERAL] database error xx000?

2012-04-26 Thread Kenneth Tilton
On Thu, Apr 26, 2012 at 2:24 PM, Tom Lane wrote: > Kenneth Tilton writes: > > I am doing a ton of pgsql over here defining and redefining functions and > > triggers and every day or so I get this: > > > Error: Database error XX000: cache lookup failed for type 5276542 &

[GENERAL] database error xx000?

2012-04-26 Thread Kenneth Tilton
I am doing a ton of pgsql over here defining and redefining functions and triggers and every day or so I get this: Error: Database error XX000: cache lookup failed for type 5276542 > > Query: select dcm.task_user_dispos(42895::bigint, 870::bigint) > > [condition type: internal-error] > > If I exi

Re: [GENERAL] efficient trigger function selection?

2012-04-11 Thread Kenneth Tilton
On Tue, Apr 10, 2012 at 4:59 PM, Jeff Davis wrote: > On Tue, 2012-04-10 at 16:07 -0400, Kenneth Tilton wrote: > > Suppose I have an RDF-style table (with columns for subject, > > predicate, various object types, and graph) and want to have dozens or > > even hundreds of trig

[GENERAL] efficient trigger function selection?

2012-04-10 Thread Kenneth Tilton
Suppose I have an RDF-style table (with columns for subject, predicate, various object types, and graph) and want to have dozens or even hundreds of trigger functions defined conditionally on the predicate, ie "when predicate = ''". My guess is Postgres is quite efficient at determining which if a

Re: [GENERAL] How return a row from a function so it is recognized as such by caller?

2012-03-28 Thread Kenneth Tilton
On Wed, Mar 28, 2012 at 4:02 PM, Merlin Moncure wrote: > On Wed, Mar 28, 2012 at 2:49 PM, Kenneth Tilton wrote: > > Well then I have the other error. With this code: > > > >execute 'select ' || NEW.warn_time_init || '($1)' into bpa using NEW; >

Re: [GENERAL] How return a row from a function so it is recognized as such by caller?

2012-03-28 Thread Kenneth Tilton
> > > On Wed, Mar 28, 2012 at 3:40 PM, Merlin Moncure wrote: > On Wed, Mar 28, 2012 at 2:08 PM, Kenneth Tilton wrote: > > Thanks, Merlin. Maybe I have some subtle detail wrong. When > > NEW.warn_time_init is 'now_plus_30' and I have this as my execute &g

Re: [GENERAL] How return a row from a function so it is recognized as such by caller?

2012-03-28 Thread Kenneth Tilton
> > >> On Wed, Mar 28, 2012 at 2:36 PM, Merlin Moncure wrote: > On Wed, Mar 28, 2012 at 1:11 PM, Kenneth Tilton wrote: > > > > > > On Wed, Mar 28, 2012 at 1:52 PM, Kenneth Tilton > wrote: > >> > >> First, apologies for being too succinct

Re: [GENERAL] How return a row from a function so it is recognized as such by caller?

2012-03-28 Thread Kenneth Tilton
On Wed, Mar 28, 2012 at 1:52 PM, Kenneth Tilton wrote: > First, apologies for being too succinct. I should have reiterated the > message subject to provide the context: I am just trying to return a row > from a function and have the caller understand it. Oh, and I am a nooby so > it

Re: [GENERAL] How return a row from a function so it is recognized as such by caller?

2012-03-28 Thread Kenneth Tilton
variable and got the same result. I'll try messing with the caller... -kt On Wed, Mar 28, 2012 at 12:54 PM, Kenneth Tilton wrote: > On version: > > PostgreSQL 9.1.2 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) > 4.4.5 20110214 (Red Hat 4.4.5-6), 64-bit > > I g

[GENERAL] How return a row from a function so it is recognized as such by caller?

2012-03-28 Thread Kenneth Tilton
On version: PostgreSQL 9.1.2 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.5 20110214 (Red Hat 4.4.5-6), 64-bit I get this error (all code at end of post) in pgAdmin: NOTICE: bpa inbound (,now_plus_30) > > CONTEXT: SQL statement "select now_plus_30(NEW)" > > PL/pgSQL function "bp_

[GENERAL] How can I modify a row in a function such that the caller sees it?

2012-03-27 Thread Kenneth Tilton
Bit of a nooby Q, tho I have researched this quite a bit and found nothing and it seems simple: I just want to modify a row in a plpgsql function such that the change can be seen by the caller. The functions happen to be called in a before trigger, to finish initializing the row. The functions are

Re: [GENERAL] possible race condition in trigger functions on insert operations?

2011-11-22 Thread Kenneth Tilton
On Tue, Nov 22, 2011 at 3:52 PM, Merlin Moncure wrote: > On Tue, Nov 22, 2011 at 2:43 PM, David Johnston wrote: >> Just create a single sequence for each year and then call the proper one >> on-the-fly.  You can create multiple sequences in advance and possible even >> auto-create the sequence th

Re: [GENERAL] possible race condition in trigger functions on insert operations?

2011-11-22 Thread Kenneth Tilton
on wrote: >> -Original Message- >> From: pgsql-general-ow...@postgresql.org >> [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Kenneth >> Tilton >> Sent: Tuesday, November 22, 2011 12:26 PM >> To: pgsql-general@postgresql.org >> Subject

Re: [GENERAL] possible race condition in trigger functions on insert operations?

2011-11-22 Thread Kenneth Tilton
On Tue, Nov 22, 2011 at 2:05 PM, Andreas Kretschmer wrote: > Kenneth Tilton wrote: > >> On Tue, Nov 22, 2011 at 12:53 PM, Andreas Kretschmer >> wrote: >> > Kenneth Tilton wrote: >> > >> >> Bit of a trigger NOOB Q: >> >> >> >

Re: [GENERAL] possible race condition in trigger functions on insert operations?

2011-11-22 Thread Kenneth Tilton
Thanks, that's perfect. -kenneth On Tue, Nov 22, 2011 at 12:53 PM, Merlin Moncure wrote: > On Tue, Nov 22, 2011 at 11:25 AM, Kenneth Tilton wrote: >> Bit of a trigger NOOB Q: >> >> I am trying to use a trigger function to automatically populate new >> rows in

Re: [GENERAL] possible race condition in trigger functions on insert operations?

2011-11-22 Thread Kenneth Tilton
On Tue, Nov 22, 2011 at 12:53 PM, Andreas Kretschmer wrote: > Kenneth Tilton wrote: > >> Bit of a trigger NOOB Q: >> >> I am trying to use a trigger function to automatically populate new >> rows in a table with  a public ID of the form -NNN such that the >

Re: [GENERAL] possible race condition in trigger functions on insert operations?

2011-11-22 Thread Kenneth Tilton
On Tue, Nov 22, 2011 at 12:48 PM, David Johnston wrote: > -Original Message- > From: pgsql-general-ow...@postgresql.org > [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Kenneth Tilton > Sent: Tuesday, November 22, 2011 12:26 PM > To: pgsql-general@postgresq

[GENERAL] possible race condition in trigger functions on insert operations?

2011-11-22 Thread Kenneth Tilton
Bit of a trigger NOOB Q: I am trying to use a trigger function to automatically populate new rows in a table with a public ID of the form -NNN such that the 42nd row created in 2011 would get the ID "2011-042". Each row is associated via an iasid column with a row in an audit table that has a

Re: [GENERAL] Noob Q collapsing multiple rows into one via case and max

2011-01-06 Thread Kenneth Tilton
On 1/6/2011 5:50 PM, Kenneth Tilton wrote: [a meta-question for all the below is "what's a good link for hairy SQL"?] A while ago I worked on a project where we had some hairy SQL collapsing multiple rows of pseudo-rdf triples (columns subject,predicate, and object) into one f

[GENERAL] Noob Q collapsing multiple rows into one via case and max

2011-01-06 Thread Kenneth Tilton
[a meta-question for all the below is "what's a good link for hairy SQL"?] A while ago I worked on a project where we had some hairy SQL collapsing multiple rows of pseudo-rdf triples (columns subject,predicate, and object) into one flattened row in which a hard-coded case/max (I forget the ex

Re: [GENERAL] nooby q: how get a row just inserted?

2009-05-30 Thread Kenneth Tilton
Martin Gainty wrote: yes i would suggest using OID included in Postgres distro is a sample create table,index named fti.pl does this answer your question? oid would have been fine, but I am going with Rodrigo's suggestion to simply use the returning option on insert which I somehow missed.

[GENERAL] nooby q: how get a row just inserted?

2009-05-30 Thread Kenneth Tilton
I am probably breaking the rules here which is why I have a problem, but here goes: I am trying to build an audit trail skeleton of all my table inserts. Everything table has a column for the serial ID of an audit trail table row I will create for each transaction or batch of transactions if I

Re: [GENERAL] Postgres, DB design, and object IDs (of any ilk)

2009-05-21 Thread Kenneth Tilton
Merlin Moncure wrote: On Thu, May 21, 2009 at 12:35 PM, Kenneth Tilton wrote: If the primary key of the customer table is cust_short_name and my DB reflects also customer departments, I can link a customer to its departments one of three ways: 1. The department table has a cust_short_name

[GENERAL] Postgres, DB design, and object IDs (of any ilk)

2009-05-21 Thread Kenneth Tilton
Just looking for postgres "best practices" input from the veterans: If the primary key of the customer table is cust_short_name and my DB reflects also customer departments, I can link a customer to its departments one of three ways: 1. The department table has a cust_short_name column and ma

[GENERAL] Noob Q: Is the PG database its own source code backup?

2009-04-27 Thread Kenneth Tilton
I find myself hacking away in pgAdmin most of the time now, after early on keeping PG source code in text files I could preserve in SVN. At this point I cannot point to anything other than the pg db itself that has a full description. Is this normal? Or do folks assiduously maintain an externa

Re: [GENERAL] delete cascade not working

2009-04-25 Thread Kenneth Tilton
Joshua Tolley wrote: On Sat, Apr 25, 2009 at 04:01:20PM -0400, Kenneth Tilton wrote: Given constraint: ALTER TABLE provider_input.common ADD CONSTRAINT common_pin_file_load_sid_fkey FOREIGN KEY (pin_file_load_sid) REFERENCES provider_input.file_load (sid) MATCH FULL ON

[GENERAL] delete cascade not working

2009-04-25 Thread Kenneth Tilton
My noob understanding is that deleteing one of these: CREATE TABLE provider_input.file_load ( sid serial NOT NULL, file_name_full text, file_name text, file_creation_date text, load_universal_time numeric, headers text, date timestamp without time zone DEFAULT now(), CONSTRAINT fi

Re: [GENERAL] Nooby Q: Should this take five hours? And counting?

2009-04-18 Thread Kenneth Tilton
Scott Marlowe wrote: On Sat, Apr 18, 2009 at 6:32 PM, Kenneth Tilton wrote: Scott Marlowe wrote: On Sat, Apr 18, 2009 at 4:11 PM, Kenneth Tilton wrote: ie, 5hrs and counting, no clue how long it intends to run, but methinks this is insane even if it is 10^7 records, mebbe half a dozen

Re: [GENERAL] Nooby Q: Should this take five hours? And counting?

2009-04-18 Thread Kenneth Tilton
Scott Marlowe wrote: > On Sat, Apr 18, 2009 at 4:11 PM, Kenneth Tilton wrote: >> ie, 5hrs and counting, no clue how long it intends to run, but methinks this >> is insane even if it is 10^7 records, mebbe half a dozen dups per value (a >> product-id usuall

[GENERAL] Nooby Q: Should this take five hours? And counting?

2009-04-18 Thread Kenneth Tilton
ie, 5hrs and counting, no clue how long it intends to run, but methinks this is insane even if it is 10^7 records, mebbe half a dozen dups per value (a product-id usually around 8-chars long): CREATE INDEX web_source_items_by_item_id_strip ON web_source_items USING

[GENERAL] string filtering in postgres?

2009-04-16 Thread Kenneth Tilton
I need to normalize a column for search purposes by stripping all non-alphanumeric characters: UPDATE my-table SET id_stripped = ??? id; I have been playing with regexp_replace( id, ,''); UPDATE my-table SET id_stripped = regexp_replace( id, ,'');id; Without much luck. Can this

Re: [GENERAL] nooby Q: temp tables good for web apps?

2009-04-07 Thread Kenneth Tilton
Scott Marlowe wrote: On Tue, Apr 7, 2009 at 7:12 PM, Kenneth Tilton wrote: Scott Marlowe wrote: You can use a different method if you need a table available to the same session. Create a schema based on the session id, and put your temp tables there, only don't call them temp t

Re: [GENERAL] nooby Q: temp tables good for web apps?

2009-04-07 Thread Kenneth Tilton
Scott Marlowe wrote: You can use a different method if you need a table available to the same session. Create a schema based on the session id, and put your temp tables there, only don't call them temp tables. You'll either need to make sure you always clean up your temp schema your session c

Re: [GENERAL] nooby Q: temp tables good for web apps?

2009-04-07 Thread Kenneth Tilton
Greg Smith wrote: Temp tables can be great for simplifying your code into more logical sections. When making a case for using them, make sure to point out that using them more aggressively can cut down on the amount of indexing you need on the big tables, which has positive implications in t

Re: [GENERAL] nooby Q: temp tables good for web apps?

2009-04-07 Thread Kenneth Tilton
Tom Lane wrote: Kenneth Tilton writes: I am porting a datamining web app to postgres from a non-sql datastore and plan to use temporary tables quite a bit, to manage collections the user will be massaging interactively. They might search and find anywhere from 50 to 50k items, then filter

[GENERAL] nooby Q: temp tables good for web apps?

2009-04-07 Thread Kenneth Tilton
I am porting a datamining web app to postgres from a non-sql datastore and plan to use temporary tables quite a bit, to manage collections the user will be massaging interactively. They might search and find anywhere from 50 to 50k items, then filter that, unfilter, sort, etc. Currently I mana