Re: [SQL] Create Calendar

2004-12-11 Thread Joe Conway
ate_series(0, 19) as t(f1); ?column? 2004-12-01 2004-12-02 2004-12-03 2004-12-04 2004-12-05 [...] 2004-12-20 (20 rows) HTH, Joe ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command

Re: [SQL] Calling a table residing in another database from Plpgsql

2005-01-05 Thread Joe Conway
alled the dblink functions into your database? See README.dblink. Joe ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] PGCrypto: Realworld scenario and advice needed

2005-04-11 Thread Joe Conway
E tbl SET f1 = encrypt(decrypt(f1, 'oldkey', 'aes'), 'newkey', 'aes'); Joe ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL

Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}

2005-05-23 Thread Joe Conway
NULL; ?column? -- t (1 row) Joe ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}

2005-05-26 Thread Joe Conway
ould be handled for an empty 1D array? The point Markus is complaining about seems like it should be easily fixable. Well, "easily" is a relative term. My Postgres hacking neurons have gotten kind of rusty lately -- but then maybe that was your underlying point ;-) Joe In

Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}

2005-06-04 Thread Joe Conway
Bruce Momjian wrote: Joe Conway wrote: Any thoughts on how this should be handled for an empty 1D array? No one responed to this email, so I will try. Is this the one dimmentional array you were talking about? test=> select array_dims('{}'::integer[]);

Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}

2005-06-06 Thread Joe Conway
A 1-D array of no elements is '[1:0]={}', just as Joe shows ... or at least it would be except for an overenthusiastic error check: regression=# select '[1:0]={}' :: int[]; ERROR: upper bound cannot be less than lower bound I think this should be a legal boundary case. In ge

[SQL] UPDATE with correlated aggregates

2006-01-29 Thread Joe Abbate
ditional column that coded the type of relationship, but couldn't figure out how to create the summary since the coded column has to be used to add the count to either the "subs" or "items" columns (or subcolumns by type). Thanks for any suggestions and comments. Joe ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] query; check for zero and floats

2006-03-31 Thread Joe Conway
end AS A1 from t1 group by g; g |a1 ---+--- 1 | 0.923076923076923 0 | 0 (2 rows) HTH, Joe ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-no

Re: [SQL] strangest thing happened

2010-07-07 Thread Joe Conway
rec.table_name; EXECUTE sql INTO startval; IF startval IS NOT NULL THEN sql := 'ALTER SEQUENCE ' || seqname || ' RESTART WITH ' || startval; EXECUTE sql; RAISE NOTICE '%', sql;

Re: [SQL] Generating Rows from a date and a duration

2010-09-08 Thread Joe Conway
010-09-03 2 | 2010-09-04 2 | 2010-09-05 2 | 2010-09-06 2 | 2010-09-07 2 | 2010-09-08 (10 rows) HTH, Joe -- Joe Conway credativ LLC: http://www.credativ.us Linux, PostgreSQL, and general Open Source Training, Service, Consulting, & 24x7 Support signature.asc Description: OpenPGP digital signature

[SQL] Correct usage of FOR UPDATE?

2010-12-11 Thread Joe Carr
Hello, I have a simple table-based queue system, and I'd looking for some advice on improving my dequeue function. it boils down to: SELECT id FROM queue WHERE FOR UPDATE NOWAIT; which works well, in that no item gets dequeued more that once. The issue, however is that when a contention occurs,

Re: [SQL] generic crosstab ?

2012-04-24 Thread Joe Conway
o idea. The error is because you are selecting from a set returning function in the target list rather than the from clause. It should be more like: SELECT * FROM crosstab(text, text) AS ( col1_name col1_type [, colN_name > colN_type]* ) HTH, Joe -- Joe Conway credativ LLC: http://www.creda

Re: [SQL] psql -F

2006-11-16 Thread Joe Conway
r with the -F option? Sorry for having gone off-topic. I was just hoping something like \t could be passed, too. Try: psql -A -t -U $DBUSER -d $DB -c "$QUERY" -F $'\t' see: man bash HTH, Joe ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] Very large IN-clause is slow, but how to rewrite it?

2007-02-25 Thread Joe Conway
.,(N$)) as t(x)) ? It would be interesting to see how that compares performance-wise. Joe ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] [GENERAL] Encrypted column

2007-06-05 Thread Joe Conway
nd I'm sure there are HMAC functions available that could be used in PL/Perl and/or PL/Python. Joe ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

[SQL] Function Syntax Help

2009-10-30 Thread Plugge, Joe R.
ount); mystart := mystart + INTERVAL '1 minute'; mystop := mystop + INTERVAL '1 minute'; END LOOP; END; $$ LANGUAGE 'plpgsql' STABLE; [cid:image002.jpg@01CA596B.59B9EC10]Joe R. Plugge Database Administrator, West Interactive Corporation 11650

Re: [SQL] Function Syntax Help

2009-10-30 Thread Plugge, Joe R.
il.com] On Behalf Of Brian Modra Sent: Friday, October 30, 2009 2:29 PM To: Plugge, Joe R. Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Function Syntax Help 2009/10/30 Plugge, Joe R. mailto:jrplu...@west.com>> I am trying to create a function that will grind through a cdr table and p

Re: [SQL] Function Syntax Help

2009-10-30 Thread Plugge, Joe R.
7;1 minute'; newstop := newstop + INTERVAL '1 minute'; END LOOP; END; $$ LANGUAGE 'plpgsql' VOLATILE; From: epai...@googlemail.com [mailto:epai...@googlemail.com] On Behalf Of Brian Modra Sent: Friday, October 30, 2009 2:46 PM To: Plugge, Joe R. Cc: pgsql-sql@

Re: [SQL] PostgreSQL Active-Active Configuration

2010-03-05 Thread Plugge, Joe R.
You may want to try Bucardo ... By performance, are you referring to latency? If so, bandwidth between sites typically is the factor with latency in any replication solution. http://bucardo.org/ -Original Message- From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgres

Re: [SQL] Simple aggregate query brain fart

2010-03-18 Thread Plugge, Joe R.
Mark, Change your query to this: SELECT id, count(*) FROM mytable GROUP BY id HAVING count(*) > 2; -Original Message- From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Mark Fenbers Sent: Thursday, March 18, 2010 10:07 AM To: pgsql-sql@postgresql

Re: [SQL] understanding select into

2010-04-09 Thread Plugge, Joe R.
Johnf, I would think that the _p, _test, _r etc are local variables within the procedure/function and this is the way that the value (from the select) gets assigned to that local variable. -Original Message- From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.or

[SQL] Column Specific Update Trigger Routine

2010-05-06 Thread Plugge, Joe R.
I am trying to create a update trigger on a table that basically will only fire when a specific column is updated. I am using version 8.4.3. My plan of attack was to always fire on any row update, and pass in the OLD and NEW column that I want to check. CREATE TRIGGER check_lockout AFTER U

Re: [SQL] Column Specific Update Trigger Routine

2010-05-06 Thread Plugge, Joe R.
Nevermind all, I figured it out Thanks Dmitriy ... From: Dmitriy Igrishin [mailto:dmit...@gmail.com] Sent: Thursday, May 06, 2010 3:25 PM To: Plugge, Joe R. Subject: Re: [SQL] Column Specific Update Trigger Routine Hey Plugge, You dont need to pass OLD.* or NEW.* to the trigger function

Re: [SQL] Column Specific Update Trigger Routine

2010-05-06 Thread Plugge, Joe R.
ownerid = OLD.ownerid; RETURN NEW; END IF; RETURN NULL; -- result is ignored since this is an AFTER trigger END; $$; Thanks !! From: Justin Graf [mailto:jus...@magwerks.com] Sent: Thursday, May 06, 2010 3:59 PM To: Plugge, Joe R.; pgsql-sql@postgresql.org Subject

Re: [SQL] how to construct sql

2010-06-02 Thread Plugge, Joe R.
This is discussed in this Wiki: http://wiki.postgresql.org/wiki/Grouping_Sets -Original Message- From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Hiltibidal, Rob Sent: Wednesday, June 02, 2010 12:06 PM To: Oliveiros; Wes James; pgsql-sql@postgr

Re: [SQL] Union Question

2010-12-03 Thread Plugge, Joe R.
You may want to try dblink. http://www.postgresql.org/docs/current/static/dblink.html From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Shaun McCloud Sent: Friday, December 03, 2010 10:51 AM To: pgsql-sql@postgresql.org Subject: [SQL] Union Question Hell

Re: [SQL] Compare two Data bases Structure

2011-02-23 Thread Plugge, Joe R.
Check out DB Solo ... http://www.dbsolo.com/ Does both DDL compare as well as data compare. From: pgsql-sql-ow...@postgresql.org [pgsql-sql-ow...@postgresql.org] On Behalf Of manuel antonio ochoa [manuel8aalf...@gmail.com] Sent: Wednesday, February 23, 2011 6:

Re: [SQL] When To Use Quotes

2012-01-05 Thread Plugge, Joe R.
Should match to the data type of the filtered value, so CHAR,VARCHAR,All DATE TYPES should be quoted. INTEGER, BIGINT, SMALLINT should not -Original Message- From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Carlos Mennens Sent: Thursday, Jan

Re: [SQL]

2013-10-08 Thread Plugge, Joe R.
1 - why two databases? Couldn't you have just created two separate SCHEMAS? 2 - if you insist on two separate databases: http://www.postgresql.org/docs/9.2/static/dblink.html From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Kaleeswaran Velu Sent: Tues

<    1   2   3