Re: [GENERAL] plPHP -- sort of an announcement.. but not commercial

2003-08-04 Thread Joe Conway
osted was claimed to be GPL, although there isn't any notice at all in the source that I saw. Does the PHP license require programs that dynamically link carry their license, similar to GPL (I didn't get that impression)? If not, then something like PL/PHP should be licensable

Re: [GENERAL] Setting/Accessing Internal data

2003-08-12 Thread Joe Conway
w.php?version=7.3&idoc=0&file=xfunc-c.html HTH, Joe ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Re: [GENERAL] PL/C functions

2003-08-14 Thread Joe Conway
different pg_proc entries and get the desired effect, at some tedium. Joe Conway has posted a few examples using this approach, IIRC. See contrib/dblink in 7.4beta -- there are several functions using this method, e.g. dblink_connect(). Joe ---(end of broadcast

Re: [GENERAL] join of array

2003-08-15 Thread Joe Conway
; ?column? --- {{1,2,3},{4,5,6}} (1 row) Offhand, I would think that '{1,2,3,4,5,6}' would be what I'd intuitively expect to get from "concatenating" these arrays. Joe, do we really have this implemented per spec? Hmmm, it made sense to me, at at least at some point ;

Re: [GENERAL] Why lower's not accept an AS declaration ?

2003-08-18 Thread Joe Conway
t.end then t.login else 'None' end as log from my_table t) as ss order by lower(log); HTH, Joe ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [GENERAL] Functions have 32 args limt ???

2003-08-28 Thread Joe Conway
ught to be higher, by all means do so. But you'll have to convince quite a few people who have no need for greater than 32 arguments why they should suffer a performance hit just because you do. Joe ---(end of broadcast)--- TIP 6: Have you se

Re: [GENERAL] Arrays and Indices / Foreign Keys

2003-08-29 Thread Joe Conway
Alex wrote: Joe, that is good news. When will be 7.4 availbable? Beta2 is just starting. There isn't a firm date for the 7.4 release that I'm aware of, but start looking for it in mid-September. Also, what i actually wanted is to ckeck that if lets say ARRAY[1,2,3] is inserted bu

Re: [GENERAL] Cross database foreign key workaround?

2003-10-08 Thread Joe Conway
that need to take place across databases? Or should I add a uid/gid to all necessary tables, create indexes and update all necessary where clauses? Ideas? What about using schemas? Joe ---(end of broadcast)--- TIP 2: you can get off all lists at

Re: [GENERAL] question on setof record returning plpgsql function

2003-10-09 Thread Joe Conway
#x27;'''''' loop return next ytd_record ; end loop; end loop; return; end' LANGUAGE 'plpgsql' VOLATILE; test=# select * from get_factory_ytd() as (tare float8, delivery_date date); tare| delivery_

Re: [GENERAL] undefined reference to 'pg_detoast_datum'

2003-10-09 Thread Joe Conway
ou need examples. unless someone can magically make the default PostgreSQL version on RH 7.3 change to a newer version of PostgreSQL, then a newer version can't be used] Why not? I have Postgres 7.3.4 running on my RH 7.3 server. Here are RH 7.3 RPMs: ftp://ftp8.us.postgresql.org/pub/pgsql/binar

Re: [GENERAL] Table partitioning for maximum speed?

2003-10-10 Thread Joe Conway
only a small chance of finding more than one row that matches. This is an interesting idea. Alternatively just use bytea and store the 16 bytes directly (i.e. no hex or base64 encoding). There is b-tree index support for bytea. Joe ---(end of broadcast

Re: [GENERAL] Table partitioning for maximum speed?

2003-10-10 Thread Joe Conway
few years ago. We never got to the point where we really needed that kind of scalability, but it worked pretty well in (limited) testing. Joe ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send &

Re: [GENERAL] [SQL] connectby

2003-10-28 Thread Joe Conway
BenLaKnet wrote: I use postgresql 7.2.3 How can I use connectby ?? Must I install files ? or packages ? or it is recommanded to upgrade dataserver ? You need to upgrade. Either install 7.3.4 or wait a few weeks and install 7.4 when it is released. Joe ---(end of

Re: [GENERAL] Custom types and arrays

2003-11-02 Thread Joe Conway
ation of a user defined composite type will not create a corresponding array type. Joe ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Re: [GENERAL] PL/Perl returning multiple rows

2003-11-10 Thread Joe Conway
and a release date? AFAIK, the only PLs that support returning multiple rows at the moment are SQL, PL/pgSQL, and PL/R. Joe ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [GENERAL] PL/Perl returning multiple rows

2003-11-10 Thread Joe Conway
or complex string parsing, etc. HTH, Joe ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html

Re: [GENERAL] PL/Perl returning multiple rows

2003-11-10 Thread Joe Conway
Christopher Murtagh wrote: On Tue, 2003-11-11 at 00:07, Joe Conway wrote: Write a Pl/Perl function that just does the syscall, and call it from PL/pgSQL. Similarly for complex string parsing, etc. That would work if I could get the Pl/Perl function to return an array or set of results, but this

Re: [GENERAL] PL/Perl returning multiple rows

2003-11-11 Thread Joe Conway
Joe Conway wrote: Christopher Murtagh wrote: That would work if I could get the Pl/Perl function to return an array or set of results, but this brings me back to the original problem (unless I'm missing something obvious). Sorry, I guess I didn't sufficiently understand the issu

Re: [GENERAL] PL/Perl returning multiple rows

2003-11-11 Thread Joe Conway
Alvaro Herrera wrote: Well, I wasn't the OP ;-). I thought Tcl had the capability, as it is sometimes said to be the most advanced PL. Nah, that would be PL/R ;-) Joe ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please

Re: [GENERAL] Proposal for a cascaded master-slave replication system

2003-11-11 Thread Joe Conway
eason, i.e.: M / \ / \ Sa Sb / \ / \ Sc Sd Se Sf What happens if data is successfully replicated to Sa, Sb, Sc, and Sd, and then an exception/rollback occurs on Se? Joe ---(end of

Re: [GENERAL] Proposal for a cascaded master-slave replication system

2003-11-11 Thread Joe Conway
27;m using a hacked copy of dbmirror at the moment. First, it does not replicate single transactions. It replicates batches of them together. Since the transactions are already committed (and possibly some other depending on them too), there is no way - you loose Se.

Re: [GENERAL] SELECT Question

2003-11-20 Thread Joe Conway
URN NEXT i; END LOOP; RETURN; END; ' LANGUAGE 'plpgsql' STRICT IMMUTABLE; regression=# select * from test(4, 8); test -- 4 5 6 7 8 (5 rows) HTH, Joe ---(end of broadcast)--- TIP 7: don't forget t

Re: [GENERAL] question about error message

2003-11-21 Thread Joe Conway
ently updated'. HTH, Joe ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [GENERAL] aggregate generic ANYARRAY

2003-11-28 Thread Joe Conway
g_attribute,pg_class,pg_inherits,pg_index,pg_operator,pg_opclass,pg_am,pg_amop,pg_amproc,pg_language,pg_largeobject,pg_aggregate,pg_trigger,pg_listener,pg_cast,pg_namespace,pg_conversion,pg_depend,pg_attrdef} public | {foo,mytable,fw_chain} (4 rows) Time: 2.518 ms HTH, Joe ---

Re: [GENERAL] Executing Shell Command

2003-11-28 Thread Joe Conway
); } CREATE OR REPLACE FUNCTION xp_shellexec(text) RETURNS int AS '$libdir/shell_exec','shell_exec' LANGUAGE 'C' VOLATILE STRICT; SELECT xp_shellexec('mkdir /tmp/testing123'); [EMAIL PROTECTED] tmp]# ls -ld /tmp/test* drwx--2 postgres postgres 409

Re: [GENERAL] Making a tree with "millions and millions" of dynamic

2003-12-04 Thread Joe Conway
r for bytea, because the bug has been there since the feature was originally committed. Joe ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that

Re: [GENERAL] Was: Triggers, Stored Procedures, PHP

2003-11-30 Thread Joe Conway
is just that, teach the optimizer how to do better with set-returning SQL functions. Joe ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your

Re: [GENERAL] dblink questions

2003-12-08 Thread Joe Conway
ent dblink connection. In that case, execute dblink_connect() before you execute your queries. Use named persistent connections if you need more than one, anonymous otherwise. HTH, Joe ---(end of broadcast)--- TIP 2: you can get off all lists at onc

[GENERAL] Transaction, Rollback and Database Corruption question,

2000-11-20 Thread Joe Kislo
he server and not some client application assosciated with PG. FYI, deleting the answer file in the db directory seemed to alleviate my problem. But obviously that is highly highly highly unacceptable. Thanks, -Joe

Re: [GENERAL] Unanswered questions about Postgre

2000-12-11 Thread Joe Kislo
on. -GRANTED- that a transaction can be aborted at anytime, and the application programmer should plan for that, but I think this postgre "feature" will cause transactions to be aborted unnecessarily; especially if people migrate from another database to postgre. Ofcourse, people really shouldn't be inserting objects which already exist, but it would still be an inconsistency between Postgre and all the other DBAdapters. Thoughts? -Joe

[GENERAL] COPY from file to table containing unique index

2001-04-10 Thread Joe Johnson
I have a table with over 1,000,000 records in it containing names and phone numbers, and one of the indexes on the table is a unique index on the phone number. I am trying to copy about 100,000 more records to the table from a text file, but I get an error on copying because of duplicate phone nu

[GENERAL] Seg fault on PQconnectdb

2010-10-13 Thread Joe La Frite
uld not find anything useful. I would really appreciate some help. Thanks in advance! (English is not my first language so I apologize if there are mistakes or I'm not being very clear.) Joe L.F.

Re: [GENERAL] Seg fault on PQconnectdb

2010-10-13 Thread Joe La Frite
On Wed, Oct 13, 2010 at 16:06, Merlin Moncure wrote: > > On Wed, Oct 13, 2010 at 5:24 AM, Joe La Frite wrote: > > Hi everyone, > > I'm trying to use libpq in my application, but it crashes with a seg fault > > when trying to connect. The call stack is as

[GENERAL] Do foreign key triggers get ran even if the key's value doesn't change?

2014-05-21 Thread Joe Van Dyk
I came across http://bonesmoses.org/2014/05/14/foreign-keys-are-not-free/ which seems to indicate so. When I run the following test script, having 50 foreign keys takes about twice as long to do the update. Is there a reason for that? Seems like the RI triggers wouldn't have to run on updates if t

Re: [GENERAL] Do foreign key triggers get ran even if the key's value doesn't change?

2014-05-21 Thread Joe Van Dyk
On Wednesday, May 21, 2014, Jeff Janes wrote: > > On Wed, May 21, 2014 at 1:11 PM, Joe Van Dyk > > > wrote: > >> I came across http://bonesmoses.org/2014/05/14/foreign-keys-are-not-free/ >> which seems to indicate so. >> >> When I run the following

Re: [GENERAL] Do foreign key triggers get ran even if the key's value doesn't change?

2014-05-22 Thread Joe Van Dyk
On Thu, May 22, 2014 at 10:52 AM, Tom Lane wrote: > Jeff Janes writes: >> On Wed, May 21, 2014 at 7:48 PM, Joe Van Dyk wrote: >>> I was expecting that the RI update triggers would have a "when (new.key is >>> distinct from old.key)" condition on them, wh

[GENERAL] adding a nullable column of type domain w/ check constraint runs checks?

2014-08-19 Thread Joe Van Dyk
I have a large table that I don't want to lock for more than couple seconds. I want to add a nullable column to the table, the type of the column is a domain with a check constraint. It appears that the check constraint is being checked for each row, even though the column can be nullable? Is ther

Re: [GENERAL] adding a nullable column of type domain w/ check constraint runs checks?

2014-08-19 Thread Joe Van Dyk
On Tue, Aug 19, 2014 at 3:10 PM, Joe Van Dyk wrote: > I have a large table that I don't want to lock for more than couple > seconds. I want to add a nullable column to the table, the type of the > column is a domain with a check constraint. > > It appears that the check

Re: [GENERAL] adding a nullable column of type domain w/ check constraint runs checks?

2014-08-19 Thread Joe Van Dyk
On Tue, Aug 19, 2014 at 3:16 PM, Joe Van Dyk wrote: > On Tue, Aug 19, 2014 at 3:10 PM, Joe Van Dyk wrote: > >> I have a large table that I don't want to lock for more than couple >> seconds. I want to add a nullable column to the table, the type of the >> co

Re: [GENERAL] adding a nullable column of type domain w/ check constraint runs checks?

2014-09-02 Thread Joe Van Dyk
On Tue, Aug 19, 2014 at 3:20 PM, Joe Van Dyk wrote: > On Tue, Aug 19, 2014 at 3:16 PM, Joe Van Dyk wrote: > >> On Tue, Aug 19, 2014 at 3:10 PM, Joe Van Dyk wrote: >> >>> I have a large table that I don't want to lock for more than couple >>> second

[GENERAL] jsonb and comparison operators

2014-09-02 Thread Joe Van Dyk
Is it possible to get this query (or a similar one) to use an index? I want to return all rows that have a value of less than 10. I have arbitrary keys I want to check (not just 'a'). drop table if exists test; create table test (j jsonb); insert into test select json_build_object('a', i)::json

Re: [GENERAL] jsonb and comparison operators

2014-09-02 Thread Joe Van Dyk
On Tue, Sep 2, 2014 at 9:55 PM, Peter Geoghegan wrote: > On Tue, Sep 2, 2014 at 9:38 PM, Joe Van Dyk wrote: > > I want to return all rows that have a value of less than 10. I have > > arbitrary keys I want to check (not just 'a'). > > > If you created an expre

[GENERAL] some queries on standby preventing replication updates

2014-10-23 Thread Joe Van Dyk
e than a minute or so), replication updates are paused. Is there a way to fix this? Thanks, Joe

[GENERAL] Finding date intersections

2014-10-23 Thread Joe Van Dyk
nge('2014-1-2', '2014-1-3')), (tstzrange('2014-1-2', '2014-1-4')), (tstzrange('2014-1-5', '2014-1-6')); -- want back: -- tstzrange('2014-1-1', '2014-1-4') -- tstzrange('2014-1-6', '2014-1-6') Thanks, Joe

Re: [GENERAL] Finding date intersections

2014-10-24 Thread Joe Van Dyk
On Fri, Oct 24, 2014 at 11:02 AM, David G Johnston < david.g.johns...@gmail.com> wrote: > John McKown wrote > >> insert into sales values > >> (tstzrange('2014-1-1', '2014-1-2')), > >> (tstzrange('2014-1-2', '2014-1-3')), > >> (tstzrange('2014-1-2', '2014-1-4')), > >> (tstzrange('2014-1-5'

Re: [GENERAL] Finding date intersections

2014-10-25 Thread Joe Van Dyk
ld use a LEFT JOIN with itself: > > WITH RECURSIVE explode(times) AS ( > SELECT times > FROM sales > UNION > SELECT a.times + b.times > FROM explode a > JOIN sales b ON b.times && a.times OR b.times -|- a.times > ) > SELECT a.times > FROM explode a > LEFT JOIN explode b ON b.times @> a.times AND b.times != a.times > WHERE b.times IS NULL > ORDER BY a.times > Perfect! Thanks! Now I just need to understand how that works.. :) Joe

[GENERAL] pg killed by oom-killer, "invalid contrecord length 2190 at A6C/331AAA90" on slaves

2014-10-25 Thread Joe Van Dyk
lave that works is in the same data center as the master -- not sure if that's related at all. Joe

Re: [GENERAL] pg killed by oom-killer, "invalid contrecord length 2190 at A6C/331AAA90" on slaves

2014-10-27 Thread Joe Van Dyk
bout the oom killer, but rather about why just one of the slaves is reporting the "invalid contrecord length" error. > I hope that's helpful. > > Regards, > basti > > On Sat 25.10.2014 22:55 +0200, Joe Van Dyk wrote: > > One of my postgres backends was killed by

Re: [GENERAL] pg killed by oom-killer, "invalid contrecord length 2190 at A6C/331AAA90" on slaves

2014-10-28 Thread Joe Van Dyk
On Tue, Oct 28, 2014 at 7:43 AM, Andres Freund wrote: > On 2014-10-25 13:55:57 -0700, Joe Van Dyk wrote: > > One of my postgres backends was killed by the oom-killer. Now, one of my > > streaming replication slaves is reporting "invalid contrecord length 2190 > > at A6C

Re: [GENERAL] some queries on standby preventing replication updates

2014-10-28 Thread Joe Van Dyk
On Mon, Oct 27, 2014 at 6:22 AM, Emanuel Calvo < emanuel.ca...@2ndquadrant.com> wrote: > > El 23/10/14 a las 17:40, Joe Van Dyk escibió: > > Hi, > > > > I have a master and a slave database. > > > > I've got hot_standby_feedback turned on, > >

[GENERAL] 9.3.6 release?

2014-12-29 Thread Joe Van Dyk
Hi, Any estimates on when 9.3.6 will be released? We've been running off 9-3-stable for the past five months, as there's some fixes in there that we need. Thanks, Joe

Re: [GENERAL] How to analyze a slowdown in 9.3.5?

2015-01-12 Thread Joe Van Dyk
rgest tables after the first DB shutdown. > One thing to check (I ran into this two weeks ago) -- even though vacuums were happening, a query running on a standby machine was preventing the vacuum process from removing the dead rows. You may want to check for bloat or use 'vacuum verbose' to see if there's many dead rows not being cleaned up. Joe

[GENERAL] Avoiding duplication of code via views -- slower? How do people typically do this?

2013-02-14 Thread Joe Van Dyk
this typically done? Thanks, Joe

Re: [GENERAL] Avoiding duplication of code via views -- slower? How do people typically do this?

2013-02-14 Thread Joe Van Dyk
On Thu, Feb 14, 2013 at 6:31 PM, Jack Christensen wrote: > Joe Van Dyk wrote: > >> See https://gist.github.com/**joevandyk/4957646/raw/** >> 86d55472ff8b5a4a6740d9c673d18a**7005738467/gistfile1.txt<https://gist.github.com/joevandyk/4957646/raw/86d55472ff8b5a4a6740d9c673d18

Re: [GENERAL] Avoiding duplication of code via views -- slower? How do people typically do this?

2013-02-15 Thread Joe Van Dyk
On Fri, Feb 15, 2013 at 7:43 AM, Tom Lane wrote: > Joe Van Dyk writes: > > Perhaps I fat-fingered something somewhere... I tried that and I got > this: > > > https://gist.github.com/joevandyk/4958906/raw/5561f95ef2b5d82f81ab14913c4d36f6aac3ee0a/gistfile1.txt > > Try w

[GENERAL] subselects vs WITH in views

2013-02-18 Thread Joe Van Dyk
My assumption was that WITH acted just like subselects, but apparently they don't? Using WITH doesn't use the expected index. (the below also at: https://gist.github.com/joevandyk/839413fac7b3bdd32cb3/raw/cec015d16bed7f4e20ab0101b58ae74a1df1cdc2/gistfile1.txt create view promotion_details1 as (

Re: [GENERAL] subselects vs WITH in views

2013-02-19 Thread Joe Van Dyk
On Tue, Feb 19, 2013 at 1:02 AM, Albe Laurenz wrote: > Joe Van Dyk wrote: > > My assumption was that WITH acted just like subselects, but apparently > they don't? Using WITH doesn't > > use the expected index. > > Currently WITH acts as an "optimization f

[GENERAL] Joining against a view that uses an aggregate - performance issue

2013-03-08 Thread Joe Van Dyk
Not sure if there's anything to be done here, just thought I'd post in case anyone has any ideas. In an ideal world, I'd be able to write version #3. Joe

Re: [GENERAL] Joining against a view that uses an aggregate - performance issue

2013-03-08 Thread Joe Van Dyk
Oops, fixing link. https://gist.github.com/joevandyk/070e4728c4c9fe1bf086/raw/8b1ecf4b2d4fd127a22cb19abe948c29d78c2158/gistfile1.txt summarizes the problem. On Fri, Mar 8, 2013 at 4:17 PM, Joe Van Dyk wrote: > > https://gist.github.com/joevandyk/070e4728c4c9fe1bf0

Re: [GENERAL] Joining against a view that uses an aggregate - performance issue

2013-03-11 Thread Joe Van Dyk
Here's a much smaller self-contained example of the problem: https://gist.github.com/joevandyk/06e1e26219726f11917e/raw/e9b279c2f2776d5825a6adbb04c7a41201f8cd24/gistfile1.txt Joe On Fri, Mar 8, 2013 at 4:17 PM, Joe Van Dyk wrote: > > https://gist.github.com/joevandyk/070e4728c4c9f

Re: [GENERAL] Testing Technique when using a DB

2013-03-12 Thread Joe Van Dyk
On Mar 12, 2013, at 8:42 AM, Perry Smith wrote: I tried posting this from Google Groups but I did not see it come through after an hour so this may be a duplicate message for some. The current testing technique for things like Ruby On Rails has three choices but all of the choices will not work

Re: [GENERAL] Testing Technique when using a DB

2013-03-13 Thread Joe Van Dyk
On Wed, Mar 13, 2013 at 8:47 AM, Steve Crawford < scrawf...@pinpointresearch.com> wrote: > On 03/12/2013 09:05 PM, Perry Smith wrote: > >> To all who replied: >> >> Thank you. ... >> >> >> I had not seriously considered pg_dump / pg_restore because I assumed it >> would be fairly slow but I will e

[GENERAL] Group by -- precedence question

2013-03-22 Thread Joe Van Dyk
begin; create table f (v numeric); insert into f values (1), (0.8); select ceil(v) as v from f group by v; -- sorta expected the result to be grouped by the column alias, -- not by the in the table v ─── 1 1 This is the correct behavior, right? To group by the column alias, I'd have to use "g

Re: [GENERAL] Trigger of Transaction

2013-04-02 Thread Joe Van Dyk
On Mon, Apr 1, 2013 at 8:41 PM, Juan Pablo Cook wrote: > Hi everyone! I need your help with this problem. > > I'm using PostgreSQL *9.2 Server* & the latest jdbc > driver: postgresql-9.2-1002.jdbc4.jar > > I have a many to one relation. I have this piece of code: > > con.setAutoCommit(false); //t

Re: [GENERAL] Using varchar primary keys.

2013-04-02 Thread Joe Van Dyk
On Mon, Apr 1, 2013 at 1:11 PM, Tim Uckun wrote: > > > > On Tue, Apr 2, 2013 at 8:35 AM, jesusthefrog wrote: > >> On the topic of 'natural' versus 'synthetic' primary keys, I am generally >> in the camp that an extra ID field won't cost you too much, and while one >> may not need it for a simple

Re: [GENERAL] Using varchar primary keys.

2013-04-02 Thread Joe Van Dyk
On Tue, Apr 2, 2013 at 11:16 AM, Merlin Moncure wrote: > On Tue, Apr 2, 2013 at 10:34 AM, Joe Van Dyk wrote: > > On Mon, Apr 1, 2013 at 1:11 PM, Tim Uckun wrote: > >> > >> > >> > >> > >> On Tue, Apr 2, 2013 at 8:35 AM, jesusthefrog &g

Re: [GENERAL] PostgreSQL Backup Booklet

2013-04-03 Thread Joe Van Dyk
On Wed, Apr 3, 2013 at 7:09 AM, Shaun Thomas wrote: > Hey! > > So, Packt approached me a few months ago and asked me to put together a > very basic series of short step-by-step instructions on backing up > PostgreSQL. The title is "Instant PostgreSQL Backup and Restore How-to." > Links for those

[GENERAL] casting tsrange to tstzrange doesn't seem to work?

2013-06-11 Thread Joe Van Dyk
# select tsrange(null)::tstzrange; ERROR: cannot cast type tsrange to tstzrange LINE 1: select tsrange(null)::tstzrange; Is this expected? select null::timestamp::timestamptz; works fine.

[GENERAL] Really poor gist index performance with tstzrange types

2013-06-11 Thread Joe Van Dyk
Am I doing something silly? Or is the row-estimation for gist indexes not even close in this case? https://gist.github.com/joevandyk/503cc3d836ee5d101224/raw/c6fc53b2da06849d3d04effbd1c147fc36124245/gistfile1.txtor code below: -- This is not running inside a transaction. drop table if exists f;

[GENERAL] Analyzing last run query in psql

2013-07-02 Thread Joe Van Dyk
pipe files into psql (if it matters). Joe

Re: [GENERAL] Analyzing last run query in psql

2013-07-03 Thread Joe Van Dyk
On Wed, Jul 3, 2013 at 6:43 AM, Oleg Bartunov wrote: > It was my dream to have something we already have in shell - > > explain analyze !$ > It would probably be: explain analyze !! (at least in bash syntax) Joe > > I think it should be not very difficult. > > Ole

Re: [GENERAL] Analyzing last run query in psql

2013-07-03 Thread Joe Van Dyk
I'd like the execution plan to be in the psql output, not in the postgres log. On Tue, Jul 2, 2013 at 11:20 PM, Andreas Kretschmer < akretsch...@spamfence.net> wrote: > Joe Van Dyk wrote: > > > I frequently need to analyze the last query in psql: > > sel

[GENERAL] Efficiency of materialized views refresh in 9.3

2013-07-04 Thread Joe Van Dyk
Hi, Is refreshing a materialized view in 9.3 basically: delete from mat_view; insert into mat_view select * from base_view; Or is it more efficient? If no rows have changed, will new tuples be written on a refresh? Joe

Re: [GENERAL] Efficiency of materialized views refresh in 9.3

2013-07-05 Thread Joe Van Dyk
On Thu, Jul 4, 2013 at 4:22 PM, Michael Paquier wrote: > On Fri, Jul 5, 2013 at 6:10 AM, Joe Van Dyk wrote: > > Hi, > > > > Is refreshing a materialized view in 9.3 basically: > > > > delete from mat_view; > > insert into mat_view select * from base_v

Re: [GENERAL] odd locking behaviour

2013-07-06 Thread Joe Van Dyk
Also on 9.3 beta2. On Thu, Jul 4, 2013 at 5:40 AM, Moshe Jacobson wrote: > Confirmed reproducible on version 9.1 as well. Very odd. > > > On Wed, Jul 3, 2013 at 1:30 PM, pg noob wrote: > >> >> Hi all, >> >> I am trying to understand some odd locking behaviour. >> I apologize in advance if this

[GENERAL] domains, case statements, functions: bug?

2013-07-08 Thread Joe Van Dyk
create domain m numeric(5,2); create table t (c m); create function f(t) returns m as $ select case when true then $1.c end $ language sql; psql:/tmp/t1.sql:3: ERROR: return type mismatch in function declared to return m DETAIL: Actual return type is numeric. CONTEXT: SQL function "f"

[GENERAL] plpgsql plan caching allowing invalid data to enter table?

2013-07-09 Thread Joe Van Dyk
It's looking like I can use a plpgsql function to insert data into a table that violates a domain constraint. Is this a known problem? Session 1: create domain my_domain text check (length(value) > 2); create table my_table (name my_domain); create function f(text) returns void as $$ declare my_

Re: [GENERAL] plpgsql plan caching allowing invalid data to enter table?

2013-07-09 Thread Joe Van Dyk
Check ┼───┼──┼──┼─── public │ my_domain │ text │ │ CHECK (length(VALUE) > 5) (1 row) On Tue, Jul 9, 2013 at 4:05 PM, Joe Van Dyk wrote: > It's looking like I can use a plpgsql function to insert data into a table > that violates a domain constraint. Is this a known problem? > >

Re: [GENERAL] plpgsql plan caching allowing invalid data to enter table?

2013-07-09 Thread Joe Van Dyk
On Tue, Jul 9, 2013 at 4:29 PM, Adrian Klaver wrote: > On 07/09/2013 04:05 PM, Joe Van Dyk wrote: > >> It's looking like I can use a plpgsql function to insert data into a >> table that violates a domain constraint. Is this a known problem? >> >> Session 1:

[GENERAL] cron tasks in pg 9.3

2013-07-18 Thread Joe Van Dyk
run whatever functions are necessary. It would be super to let postgresql handle all of that. Joe

Re: [GENERAL] cron tasks in pg 9.3

2013-07-18 Thread Joe Van Dyk
On Thu, Jul 18, 2013 at 2:31 PM, Thomas Kellerer wrote: > Joe Van Dyk wrote on 18.07.2013 23:23: > > Will the custom worker support in 9.3 let me put cron-like tasks into >> postgresql? >> >> I have a lot of database functions that should run every few seconds, >&g

Re: [GENERAL] how _not_ to log?

2013-07-25 Thread Joe Van Dyk
On Thursday, July 25, 2013, Tim Spencer wrote: > Hello there! > > I've seen lots of people who have asked questions about how to log > this or that, but I have the opposite question! :-) I'm seeing this in my > logs: > > Jul 25 18:08:11 staging-db11 postgres[27050]: [10-2] STATEMENT: cr

Re: [GENERAL] casting tsrange to tstzrange doesn't seem to work?

2013-07-26 Thread Joe Van Dyk
On Friday, July 5, 2013, Jeff Davis wrote: > On Tue, 2013-06-11 at 14:05 -0700, Joe Van Dyk wrote: > > # select tsrange(null)::tstzrange; > > ERROR: cannot cast type tsrange to tstzrange > > LINE 1: select tsrange(null)::tstzrange; > > > I agree that there should

[GENERAL] Adding ip4r to Postgresql core?

2013-08-07 Thread Joe Van Dyk
Hi, Any chance ip4r could be an official postgresql extension? It's got a lot of advantages over the existing cidr/inet stuff. https://github.com/RhodiumToad/ip4r-historical/blob/master/README.ip4r Joe

[GENERAL] Why doesn't COPY support the HEADER options for tab-separated output?

2013-08-12 Thread Joe Van Dyk
Mostly just curious, as this is preventing me from using tab-separated output. I'd like there to be a header in my files. I have to use CSVs instead. Joe

Re: [GENERAL] uuids with btree_gist

2013-09-03 Thread Joe Van Dyk
On Tue, Sep 3, 2013 at 1:41 PM, Martin Renters wrote: > I'm trying to use timestamp ranges to keep track of the values particular > items had over time, but I'm unable to create a table as follows: > > test=# create extension btree_gist; > CREATE EXTENSION > test=# create table v(item uuid, lifet

[GENERAL] Report the trigger name when complaining about "tuple to be updated was already modified by an operation triggered by the current command"?

2013-10-21 Thread Joe Van Dyk
there be? (I fixed the error by moving the before trigger to an after one.) Joe

Re: [GENERAL] Changing function from SECURITY DEFINER to SECURITY INVOKER changes query plan?

2013-11-21 Thread Joe Van Dyk
On Thu, Nov 21, 2013 at 6:11 PM, Tom Lane wrote: > Joe Van Dyk writes: > > I had a function that was set to SECURITY INVOKER. I needed to give > access > > to a view that uses this function to a role, so I made the function > > SECURITY DEFINER. > > > The

[GENERAL] Changing function from SECURITY DEFINER to SECURITY INVOKER changes query plan?

2013-11-21 Thread Joe Van Dyk
I had a function that was set to SECURITY INVOKER. I needed to give access to a view that uses this function to a role, so I made the function SECURITY DEFINER. The function is STABLE and is usually inlined and takes 2 ms to run. Immediately, the function quit being inlined and took 1500ms to run

[GENERAL] Replication failed after stalling

2013-12-18 Thread Joe Van Dyk
a from 3:30 am to 10 am, then start complaining about missing WAL files. What's the best way to avoid this problem? Increase wal_keep_segments? Joe

Re: [GENERAL] Replication failed after stalling

2013-12-18 Thread Joe Van Dyk
) On Wed, Dec 18, 2013 at 11:26 AM, Joe Van Dyk wrote: > I'm running Postgresql 9.3. I have a streaming replication server. Someone > was running a long COPY query (8 hours) on the standby which halted > replication. The replication stopped at 3:30 am. I canceled the > long-r

[GENERAL] to_json(now()) result doesn't have 'T' separator

2013-12-20 Thread Joe Van Dyk
own date format, but I'd really like to be able to use row_to_json and other functions without specifying custom date formats everywhere. Joe

Re: [GENERAL] to_json(now()) result doesn't have 'T' separator

2013-12-20 Thread Joe Van Dyk
On Fri, Dec 20, 2013 at 4:18 PM, Joe Van Dyk wrote: > # select to_json(now()); > to_json > - > "2013-12-20 15:53:39.098204-08" > (1 row) > > I'd like to see it output "2013-12-20T15:53:39.098204-08&quo

Re: [GENERAL] to_json(now()) result doesn't have 'T' separator

2013-12-20 Thread Joe Van Dyk
On Fri, Dec 20, 2013 at 4:24 PM, Joe Van Dyk wrote: > > > On Fri, Dec 20, 2013 at 4:18 PM, Joe Van Dyk wrote: > >> # select to_json(now()); >> to_json >> - >> "2013-12-20 15:53:39.098204-08" >> (1

Re: [GENERAL] to_json(now()) result doesn't have 'T' separator

2013-12-23 Thread Joe Van Dyk
ay to easily let javascript applications parse json timestamps generated by postgresql in row_to_json() statements. On Fri, Dec 20, 2013 at 6:27 PM, Joe Van Dyk wrote: > On Fri, Dec 20, 2013 at 4:24 PM, Joe Van Dyk wrote: > >> >> >> On Fri, Dec 20, 2013 at 4:18 PM, Joe Va

Re: [GENERAL] to_json(now()) result doesn't have 'T' separator

2013-12-23 Thread Joe Van Dyk
w()); insert into t values (default); select row_to_json(t) from t; row_to_json --- {"id":1,"created_at":"2013-12-23 17:37:08.825935-08"} On Mon, Dec 23, 2013 at 5:28 PM, Joe Van Dyk wro

Re: [GENERAL] Replication failed after stalling

2013-12-29 Thread Joe Van Dyk
On Wed, Dec 18, 2013 at 3:39 PM, Sergey Konoplev wrote: > On Wed, Dec 18, 2013 at 11:26 AM, Joe Van Dyk wrote: > > I'm running Postgresql 9.3. I have a streaming replication server. > Someone > > was running a long COPY query (8 hours) on the standby which halt

Re: [GENERAL] Replication failed after stalling

2013-12-30 Thread Joe Van Dyk
On Mon, Dec 30, 2013 at 10:27 AM, Sergey Konoplev wrote: > On Mon, Dec 30, 2013 at 12:02 AM, Joe Van Dyk wrote: > > On Sun, Dec 29, 2013 at 10:52 PM, Sergey Konoplev > wrote: > >> On Sun, Dec 29, 2013 at 9:56 PM, Joe Van Dyk wrote: > >> > On Wed, Dec 18,

Re: [GENERAL] Replication failed after stalling

2013-12-30 Thread Joe Van Dyk
On Mon, Dec 30, 2013 at 9:11 PM, Sergey Konoplev wrote: > On Mon, Dec 30, 2013 at 8:56 PM, Joe Van Dyk wrote: > > On Mon, Dec 30, 2013 at 10:27 AM, Sergey Konoplev > wrote: > >> On Mon, Dec 30, 2013 at 12:02 AM, Joe Van Dyk wrote: > >> > On Sun, Dec 29,

Re: [GENERAL] Is there a way to return "true"/"false" string for boolean type?

2014-01-07 Thread Joe Van Dyk
egards, >> Szymon >> > > In the custom stored function, I'm returning a resultset using hstore > function. > RETURN QUERY SELECT a few other columns, hstore(t.*) FROM table t WHERE > condition. > > I don't want to change it to > > SELECT a few other columns, hstore('c1', CAST(t.c1 AS TEXT)) || > hstore('c2', CAST(t.c2 AS TEXT)) || ...hstore('cn', t.cn::text) || ... > FROM table t WHERE condition. > Can you use json instead of hstore? # select * from test; id | b +--- 1 | t 2 | f # select to_json(test) from test; to_json {"id":1,"b":true} {"id":2,"b":false} Joe

<    1   2   3   4   5   6   >