Re: [SQL] Partitionning + Trigger and Execute not working as expected

2011-11-09 Thread Josh Kupershmidt
On Wed, Nov 9, 2011 at 4:39 PM, Sylvain Mougenot wrote: > As I mentioned before, your code works on special cases (insert with all the > columns) and those are very few cases. > Try this > CREATE TABLE foo (a int, b int); > CREATE TABLE job_2011_11 (c int, d int); > > CREATE OR REPLACE FUNCTION jo

Re: [SQL] Partitionning + Trigger and Execute not working as expected

2011-11-09 Thread Josh Kupershmidt
On Wed, Nov 9, 2011 at 6:57 AM, Sylvain Mougenot wrote: > Even if the query below is fine (the exact content I try to build as a > String to use with EXECUTE) > INSERT INTO job_2011_11 values (NEW.*) > Is there a way to solve this? > Isn't it a bug (in how EXECUTE works)? I doubt this is a bug i

Re: [SQL] Partitionning + Trigger and Execute not working as expected

2011-11-08 Thread Josh Kupershmidt
On Tue, Nov 8, 2011 at 11:04 AM, Sylvain Mougenot wrote: > EXECUTE 'INSERT INTO '|| currentTableName || ' values (NEW.*)'; The quotes in the above line are wrong; you want it like: EXECUTE 'INSERT INTO '|| currentTableName || ' values ' || (NEW.*); Josh -- Sent via pgsql-sql mailing list (pgs

Re: [SQL] insert or update within transaction

2011-09-17 Thread Josh Kupershmidt
On Sat, Sep 17, 2011 at 10:52 AM, Andreas wrote: > Instead of the update the query fails with an double key value error for the > primary key. > Shouldn't the insert fail, get rolled back and then exercute an update > instead successfully? Yes, and that is indeed what I see when I run your exampl

Re: [SQL] Generic design: char vs varchar primary keys

2011-08-03 Thread Josh Kupershmidt
2011/8/3 Raj Mathur (राज माथुर) : > Hi, > > Can you point me to any pages that explain the difference between using, > say CHAR(8) vs VARCHAR(8) as the primary key for a table?  Is there any > impact on the database in terms of: > > - Speed of indexed retrieval > - Speed of join from a referencing

Re: [SQL] Compare the resulta of a count sql into bash

2011-01-26 Thread Josh Kupershmidt
On Wed, Jan 26, 2011 at 12:07 PM, manuel antonio ochoa wrote: > > Hello, > I have the next : > > COUNTONE=`/var/lib/pgsql/bin/./psql -U 'Thor'   -d princlocal -p 5432 -h > 192.170.1.82  -c "select count(*) from monterrey.${NOMBRETB}"` > COUNTTWO=`/var/lib/pgsql/bin/./psql -U 'Thor'   -dprinclocal

Re: [SQL] window function to sort times series data?

2010-03-24 Thread Josh Kupershmidt
On Wed, Mar 24, 2010 at 2:38 PM, John Gage wrote: > In going through the arcana of string functions, I have come across the > following series of selects that contain, for me, a mysterious "$re$". > > -- return all matches from regexp > SELECT regexp_matches('foobarbequebaz', $re$(bar)(beque)$re$)