Re: Enforce primary key on every table during dev?

2018-02-28 Thread Melvin Davidson
On Wed, Feb 28, 2018 at 4:07 PM, Tim Cross wrote: > > Jeremy Finzel writes: > > > We want to enforce a policy, partly just to protect those who might > forget, > > for every table in a particular schema to have a primary key. This can't > > be done

Re: selecting timestamp

2018-02-28 Thread chris
Thank you everyone for the help. Sorry there wasn't much detail given originally. CURRENT_TIMESTAMP at time zone 'UTC' as ct4 Seems to be working well. Thanks, Chris On 02/27/2018 01:26 PM, David G. Johnston wrote: On Tue, Feb 27, 2018 at 1:16 PM, chris

Re: Enforce primary key on every table during dev?

2018-02-28 Thread Tim Cross
Jeremy Finzel writes: > We want to enforce a policy, partly just to protect those who might forget, > for every table in a particular schema to have a primary key. This can't > be done with event triggers as far as I can see, because it is quite > legitimate to do: > >

Re: How to avoid trailing zero (after decimal point) for numeric type column

2018-02-28 Thread Charles Clavadetscher
Hello > On 28.02.2018, at 13:33, pkashimalla wrote: > > Hello Team, > > We have recently migrated our database from Oracle > And there are few of my tables with numeric column type. > > In below example > I did insertion from java program with below code snippet >

How to avoid trailing zero (after decimal point) for numeric type column

2018-02-28 Thread pkashimalla
Hello Team, We have recently migrated our database from Oracle And there are few of my tables with numeric column type. In below example I did insertion from java program with below code snippet Double object = 10.0; String inserRecordQuery_NEWWAY11 = "INSERT INTO BLOB_TEST_TABLE(id)VALUES

Re: Parallel index creation & pg_stat_activity

2018-02-28 Thread Andres Freund
Hi Peter, On 2018-02-28 16:50:44 +, Phil Florent wrote: > With an index creation (create index t1_i1 on t1(c1, c2);) I have this kind > of output : > > ./t -d 20 -o "pid, backend_type, query, wait_event_type, wait_event" > busy_pc | distinct_exe | pid | backend_type | query

Parallel index creation & pg_stat_activity

2018-02-28 Thread Phil Florent
Hi, I created an index on a 11devel base while sampling pg_stat_activity with a little tool. Tool catches a line if state = active. Collected rows are aggregated and sorted by activity percentage. Test environment : select version();

Re: Enforce primary key on every table during dev?

2018-02-28 Thread David G. Johnston
On Wed, Feb 28, 2018 at 6:34 AM, Jeremy Finzel wrote: > We want to enforce a policy, partly just to protect those who might > forget, for every table in a particular schema to have a primary key. This > can't be done with event triggers as far as I can see, because it is

Re: Enforce primary key on every table during dev?

2018-02-28 Thread John McKown
On Wed, Feb 28, 2018 at 7:57 AM, Adrian Klaver wrote: > On 02/28/2018 05:52 AM, John McKown wrote: > >> On Wed, Feb 28, 2018 at 7:34 AM, Jeremy Finzel > >wrote: >> >> We want to enforce a policy, partly just to protect

Re: Enforce primary key on every table during dev?

2018-02-28 Thread Melvin Davidson
On Wed, Feb 28, 2018 at 8:57 AM, Adrian Klaver wrote: > On 02/28/2018 05:52 AM, John McKown wrote: > >> On Wed, Feb 28, 2018 at 7:34 AM, Jeremy Finzel > >wrote: >> >> We want to enforce a policy, partly just to protect

Re: Enforce primary key on every table during dev?

2018-02-28 Thread Adrian Klaver
On 02/28/2018 05:52 AM, John McKown wrote: On Wed, Feb 28, 2018 at 7:34 AM, Jeremy Finzel >wrote: We want to enforce a policy, partly just to protect those who might forget, for every table in a particular schema to have a primary key. 

Re: Enforce primary key on every table during dev?

2018-02-28 Thread John McKown
On Wed, Feb 28, 2018 at 7:34 AM, Jeremy Finzel wrote: > We want to enforce a policy, partly just to protect those who might > forget, for every table in a particular schema to have a primary key. This > can't be done with event triggers as far as I can see, because it is

Enforce primary key on every table during dev?

2018-02-28 Thread Jeremy Finzel
We want to enforce a policy, partly just to protect those who might forget, for every table in a particular schema to have a primary key. This can't be done with event triggers as far as I can see, because it is quite legitimate to do: BEGIN; CREATE TABLE foo (id int); ALTER TABLE foo ADD

Re: Given a set of daterange, finding the continuous range that includes a particular date (aggregates)

2018-02-28 Thread mariusz
hi, On Tue, 2018-02-27 at 16:15 -0800, Ken Tanzer wrote: > Hi. Thanks so much for your assistance. This is definitely getting > the results I was looking for. It is still syntacticallly more > cumbersome than I might have hoped, but I can work with it. So I've > got two follow

Re: Parallel Query - Can it be used within functions?

2018-02-28 Thread Michael Krüger
Ok, to close this thread. The problem is, that plpgsql function do seem to return data using a cursor. That fact is disabling parallel execution. So if we instead hand over the SQL to a function with e.g. a python body, then parallel execution is happening, because the data is first assembled in

Re: Parallel Query - Can it be used within functions?

2018-02-28 Thread Michael Krüger
ah, and for completeness the simple python function I use for the test: create or replace function reports.generic_query_python(_sql text) RETURNS SETOF record LANGUAGE 'plpythonu' PARALLEL SAFE COST 100 VOLATILE ROWS 5000 AS $BODY$ return plpy.execute( _sql ) $BODY$; Michael