Re: [GENERAL] moving to PostgreSQL from MS-SQL and from Oracle, looking for feature comparison information

2015-05-09 Thread Jack Christensen
On 05/09/2015 06:33 AM, Stephen Frost wrote: Temporary tables will be in memory unless they overflow work_mem and we do support unlogged tables and tablespaces which you could stick out on a ramdisk if you want. I would suggest not putting a table space on a ramdisk. According to the docs this

[GENERAL] log_statement = 'mod' does not log all data modifying statements

2015-06-12 Thread Jack Christensen
I was recently surprised by changes that were not logged by log_statement = 'mod'. After changing log_statement to 'all', I found that the changes were occurring in a writable CTE. Is there a way to log all statements that update data? Jack -- Sent via pgsql-general mailing list (pgsql-gene

[GENERAL] Text to interval conversion can silently truncate data

2015-07-01 Thread Jack Christensen
jack=# select '1.51 years'::interval = '1.52 years'::interval; ?column? -- t (1 row) This is surprising. Once I looked at the C code for Interval it makes more sense given that it cannot represent fractional years, months, or days. Wouldn't it make more sense to raise an invalid input

Re: [GENERAL] Permissions, "soft read failure" - wishful thinking?

2015-12-14 Thread Jack Christensen
On 12/14/2015 11:55 AM, Benjamin Smith wrote: Is there a way to set PG field-level read permissions so that a deny doesn't cause the query to bomb, but the fields for which permission is denied to be nullified? In our web-based app, we have a request to implement granular permissions: table/fiel

[GENERAL] What is the name pseudo column

2010-12-15 Thread Jack Christensen
an array (but longer rows get truncated). I've searched Google and the PG docs but I haven't had any luck. -- Jack Christensen ja...@hylesanderson.edu -- 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] What is the name pseudo column

2010-12-16 Thread Jack Christensen
On 12/15/2010 5:43 PM, Adrian Klaver wrote: On Wednesday 15 December 2010 1:27:19 pm David Fetter wrote: On Wed, Dec 15, 2010 at 01:50:54PM -0600, Jack Christensen wrote: I was just surprised when accidentally selecting a non-existent name column there was no error -- instead something came

[GENERAL] Deferred foreign key constraint downsides

2011-04-08 Thread Jack Christensen
occurred since the error won't be raised until commit. Are there any other downsides to just setting all my foreign keys to initially deferred? Thanks. -- Jack Christensen ja...@hylesanderson.edu -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to

[GENERAL] PLV8 for PostgreSQL 9.4 on Ubuntu 14.04

2014-12-19 Thread Jack Christensen
With PostgreSQL 9.3 I installed plv8 from apt.postgresql.org (http://www.postgresql.org/download/linux/ubuntu/). It doesn't appear that it is available for 9.4. Is this no longer offered or has it just not available yet? Thanks. Jack -- Sent via pgsql-general mailing list (pgsql-general@po

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

2013-02-14 Thread Jack Christensen
Joe Van Dyk wrote: See https://gist.github.com/joevandyk/4957646/raw/86d55472ff8b5a4a6740d9c673d18a7005738467/gistfile1.txt for the code. I have promotions(id, end_at, quantity) and promotion_usages(promotion_id). I have a couple of things I typically want to retrieve, and I'd like those t

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

2013-02-15 Thread Jack Christensen
Joe Van Dyk wrote: Perhaps I fat-fingered something somewhere... I tried that and I got this: https://gist.github.com/joevandyk/4958906/raw/5561f95ef2b5d82f81ab14913c4d36f6aac3ee0a/gistfile1.txt The with_filters view uses a different plan. Interesting. It is avoiding the hash join, but it

[GENERAL] Possible bug with row_to_json

2013-08-05 Thread Jack Christensen
layer_id":1,"name":"Jack"} (1 row) It ignored the rename. jack=# select row_to_json(t) from ( select name, player_id as renamed from player order by name ) t; row_to_json ----- {"name":"Jack","renamed":1} (1 row) But here it didn't. Is this a bug? Jack Christensen

Re: [GENERAL] Forcing materialize in the planner

2013-08-16 Thread Jack Christensen
Have you tried putting those components in a common table expression? I'm not sure if it absolutely forces the materialization or not, but in practice that has been my experience. Robert James wrote: I have a query which, when I materialize by hand some of its components, runs 10x faster (incl

Re: [GENERAL] Custom shuffle function stopped working in 9.6

2017-02-11 Thread Jack Christensen
On 02/11/2017 11:36 AM, Adrian Klaver wrote: On 02/11/2017 09:17 AM, Alexander Farber wrote: I think ORDER BY RANDOM() has stopped working in 9.6.2: words=> select unnest(ARRAY['a','b','c','d','e','f']) order by random(); unnest a b c d e f (6 rows) postgres=> select ve

[GENERAL] Is auto-analyze as thorough as manual analyze?

2017-09-23 Thread Jack Christensen
Just had an issue where a prepared query would occasionally choose a very bad plan in production. The same data set in a different environment consistently would choose the index scan. As would be expected, running analyze on that table in production resolved the issue. However, before I ran t

[GENERAL] Multiple table relationship constraints

2011-05-05 Thread Jack Christensen
. Validate application side -- this can work well, but it leaves the hole of a bug in the application or a direct SQL statement going bad. Anyone have any advice on the best way to handle this? -- Jack Christensen ja...@hylesanderson.edu -- Sent via pgsql-general mailing list (pgsql-general

Re: [GENERAL] Multiple table relationship constraints

2011-05-05 Thread Jack Christensen
On 5/5/2011 2:28 PM, Rick Genter wrote: On Thu, May 5, 2011 at 3:20 PM, Jack Christensen mailto:ja...@hylesanderson.edu>> wrote: What is the best way to handle multiple table relationships where attributes of the tables at the ends of the chain must match? Example:

Re: [GENERAL] Multiple table relationship constraints

2011-05-05 Thread Jack Christensen
On 5/5/2011 2:53 PM, Rick Genter wrote: On Thu, May 5, 2011 at 3:50 PM, Jack Christensen mailto:ja...@hylesanderson.edu>> wrote: The trick is there are additional attributes of actions and achievements such as a category that must match for the link to be valid. These attr

Re: [GENERAL] Multiple table relationship constraints

2011-05-09 Thread Jack Christensen
won't. Thanks everyone for your advice. I think this type of approach will be very helpful. -- Jack Christensen ja...@hylesanderson.edu -- 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] implementing check-in/check-out of an items table

2011-05-20 Thread Jack Christensen
NOT NULL REFERENCES items, start_time timestamptz NOT NULL, end_time timestamptz ... ); CREATE UNIQUE INDEX ON loans(item_id) WHERE end_time IS NULL; -- Jack Christensen ja...@hylesanderson.edu -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to you

Re: [GENERAL] implementing check-in/check-out of an items table

2011-05-20 Thread Jack Christensen
On 5/20/2011 10:15 AM, Seb wrote: On Fri, 20 May 2011 09:48:45 -0500, Jack Christensen wrote: Use a loans table with unique partial index to ensure that only one unreturned loan per item can exist at a time. [...] Thanks, this certainly avoids loaning an item before it's returned, b

Re: [GENERAL] WITH x AS (...) and visibility in UPDATE

2011-07-27 Thread Jack Christensen
ith some new values and some copied values? -- Jack Christensen ja...@hylesanderson.edu -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] Failure controlling PG 9.1 service on Ubuntu 10.04 32-bit

2011-10-07 Thread Jack Christensen
* Error: Could not open /proc/2193/comm [fail] It seems to be happening in /usr/share/postgresql-common/PgCommon.pm:542 PostgreSQL is actually running fine, but the only way I can make any changes is to reboot the server (or kill all the postgres processes I suppose). -- Jack Christensen ja

Re: [GENERAL] Failure controlling PG 9.1 service on Ubuntu 10.04 32-bit

2011-10-10 Thread Jack Christensen
On 10/8/2011 1:21 AM, Craig Ringer wrote: On 10/08/2011 02:23 AM, Jack Christensen wrote: Just upgraded a machine from PostgreSQL 9.0 to 9.1. I uninstalled the old version then installed the new one. Whenever I try to run a service command to start, stop, or restart the server it fails. jackc

Re: [GENERAL] Complex database infrastructure - how to?

2012-06-30 Thread Jack Christensen
son. Consider using one database with multiple schemas. You can separate your applications into their own schemas, and you can have cross-schema foreign keys. -- Jack Christensen http://jackchristensen.com/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make chang

Re: [GENERAL] Picking the first of an order in an aggregate query

2012-12-31 Thread Jack Christensen
), field_a, field_b from ... order by grouping_field, field_a asc, field_b asc http://www.postgresql.org/docs/9.2/static/sql-select.html#SQL-DISTINCT -- Jack Christensen http://jackchristensen.com/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your su

[GENERAL] Why does aggregate query allow select of non-group by or aggregate values?

2011-12-09 Thread Jack Christensen
r an aggregate function be rejected? What am I not understanding? Thanks. -- Jack Christensen ja...@hylesanderson.edu -- 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] Why does aggregate query allow select of non-group by or aggregate values?

2011-12-10 Thread Jack Christensen
he outer query, and when I tried to use a non-grouped column from the outer query I correctly got a ERROR: subquery uses ungrouped column "foo" from outer query Thanks again. -- Jack Christensen ja...@hylesanderson.edu -- Sent via pgsql-general mailing list (pgsql-general@postg

[GENERAL] Set returning functions in select column list

2012-02-16 Thread Jack Christensen
* Apologies if anyone receives this twice. I previously sent it from another address and it did not appear to go through. Can someone explain how set returning functions in a select clause work? It seems that it is doing some sort of implicit cross join. deliverance_development=# select id, ge

[GENERAL] Functions that return a set in select column list

2012-02-16 Thread Jack Christensen
* Apologies if anyone receives this multiple times. I previously sent it with a subject that started with "Set" and it triggered some sort of admin filter. Can someone explain how set returning functions in a select clause work? It seems that it is doing some sort of implicit cross join. deli

[GENERAL] Set returning functions in select column list

2012-02-16 Thread Jack Christensen
ve checked Google and the PostgreSQL docs, but it appears either I do not know the key words to search for or it is sparsely documented. -- Jack Christensen ja...@hylesanderson.edu -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscrip

Re: [GENERAL] Optimise PostgreSQL for fast testing

2012-02-23 Thread Jack Christensen
e test suite is of vital importance to developers. A 30 second difference 100's of times per day really can add up. -- Jack Christensen ja...@hylesanderson.edu -- 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] Subselect with incorrect column not a syntax error?

2012-04-13 Thread Jack Christensen
c4 = 2 ); rollback; Mike Your subquery is correlated with the outer query. So the c2 in the subquery is referring to table x. -- Jack Christensen ja...@hylesanderson.edu -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http