Re: In certain cases, can UPDATE transactions fail rather than block waiting for “FOR UPDATE lock”?

2018-07-20 Thread Alvaro Herrera
On 2018-Jul-20, Praveen Kumar wrote: > Regarding UPDATEs on rows that are locked via "SELECT FOR UPDATE" in > another transaction, I read the above as follows: other transactions that > attempt UPDATE of these rows will be blocked until the current transaction > ( which did "SELECT FOR UPDATE" fo

Re: sql questions

2018-07-20 Thread hamann . w
>> Zitat von haman...@t-online.de: >> >> > a) I am running some select query >> > select ... order by >> > Now, I would like to preserver the ordering through further >> > processing by adding a sequence number >> > Of course I can do: >> > create temp sequence mseq; >> > select xx.*, ne

Re: User documentation vs Official Docs

2018-07-20 Thread Joshua D. Drake
On 07/20/2018 05:31 PM, Adrian Klaver wrote: On 07/20/2018 04:48 PM, Joshua D. Drake wrote: On 07/20/2018 03:59 PM, Alvaro Herrera wrote: I don't see why we need this thread to continue.  This sounds like somebody looking for a solution when they don't yet know what the problem is. Unfortuna

Re: User documentation vs Official Docs

2018-07-20 Thread Joshua D. Drake
On 07/20/2018 04:56 PM, Stephen Frost wrote: +1. I'd personally like to see improvements to the tutorials, and patches could certainly be submitted or specific ideas discussed over on -docs. A few ideas around that would be: - Setting up async replication - Setting up sync replication, with q

Re: User documentation vs Official Docs

2018-07-20 Thread Adrian Klaver
On 07/20/2018 04:48 PM, Joshua D. Drake wrote: On 07/20/2018 03:59 PM, Alvaro Herrera wrote: I don't see why we need this thread to continue.  This sounds like somebody looking for a solution when they don't yet know what the problem is. Unfortunately, you don't understand the problem which i

Re: User documentation vs Official Docs

2018-07-20 Thread David G. Johnston
On Friday, July 20, 2018, Joshua D. Drake wrote: > > I was hoping to get the -general community to step and build some recipes > and howto articles without at the same time dictating the solution. That's > a good thing because a non-dictated solution is likely to have more > strength. > People ha

Re: User documentation vs Official Docs

2018-07-20 Thread Rob Sargent
On 07/20/2018 05:48 PM, Joshua D. Drake wrote: On 07/20/2018 03:59 PM, Alvaro Herrera wrote: I don't see why we need this thread to continue.  This sounds like somebody looking for a solution when they don't yet know what the problem is. Unfortunately, you don't understand the problem whic

Re: User documentation vs Official Docs

2018-07-20 Thread Stephen Frost
Greetings, * Alvaro Herrera (alvhe...@2ndquadrant.com) wrote: > I don't see why we need this thread to continue. This sounds like > somebody looking for a solution when they don't yet know what the > problem is. > > If people want to contribute, there are already some places where they > can do

Re: User documentation vs Official Docs

2018-07-20 Thread Joshua D. Drake
On 07/20/2018 03:59 PM, Alvaro Herrera wrote: I don't see why we need this thread to continue. This sounds like somebody looking for a solution when they don't yet know what the problem is. Unfortunately, you don't understand the problem which is why this thread is happening on -general and

In certain cases, can UPDATE transactions fail rather than block waiting for “FOR UPDATE lock”?

2018-07-20 Thread Praveen Kumar
I'm using Postgres 9.6.5. In the docs under-- [13.3. Explicit Locking][ https://www.postgresql.org/docs/9.6/static/explicit-locking.html] "13.3.2. Row-level Locks" -> "Row-level Lock Modes" -> "FOR UPDATE": ''' FOR UPDATE causes the rows retrieved by the SELECT statement to be locked as though

Re: User documentation vs Official Docs

2018-07-20 Thread Melvin Davidson
On Fri, Jul 20, 2018 at 6:59 PM, Alvaro Herrera wrote: > On 2018-Jul-20, Adrian Klaver wrote: > > > On 07/20/2018 11:45 AM, Joshua D. Drake wrote: > > > > Back to the original idea, it would be great if those participating > > > would be willing to help even a little in determining an actual > >

Re: User documentation vs Official Docs

2018-07-20 Thread Alvaro Herrera
On 2018-Jul-20, Adrian Klaver wrote: > On 07/20/2018 11:45 AM, Joshua D. Drake wrote: > > Back to the original idea, it would be great if those participating > > would be willing to help even a little in determining an actual > > direction to take this. > > I would say that discussion should tak

Re: Postgres function with output parameters and resultset

2018-07-20 Thread Adrian Klaver
On 07/20/2018 02:19 PM, Arulalan Narayanasamy wrote: Hi, I need to create a function which should return resultset and output parameters. For example, I need to retrieve all the records from EMP table whose Grade is 'A' as resultset and total number of matched records, Success or Failure flag

Re: Postgres function with output parameters and resultset

2018-07-20 Thread David G. Johnston
On Friday, July 20, 2018, Arulalan Narayanasamy < arulalan.narayanas...@gmail.com> wrote: > Hi, > I need to create a function which should return resultset and output > parameters. For example, I need to retrieve all the records from EMP table > whose Grade is 'A' as resultset and total number of

Postgres function with output parameters and resultset

2018-07-20 Thread Arulalan Narayanasamy
Hi, I need to create a function which should return resultset and output parameters. For example, I need to retrieve all the records from EMP table whose Grade is 'A' as resultset and total number of matched records, Success or Failure flag & Error message as output parameters. Is there a way in Po

Re: User documentation vs Official Docs

2018-07-20 Thread Adrian Klaver
On 07/20/2018 11:45 AM, Joshua D. Drake wrote: On 07/20/2018 10:38 AM, George Neuner wrote: As libraries allow users/citizens to request books be purchased at no cost to the user/citizen, the argument that someone cannot afford a book is now a moot point. This thread is getting off topic. Th

Re: User documentation vs Official Docs

2018-07-20 Thread Joshua D. Drake
On 07/20/2018 10:38 AM, George Neuner wrote: As libraries allow users/citizens to request books be purchased at no cost to the user/citizen, the argument that someone cannot afford a book is now a moot point. This thread is getting off topic. The tl;dr; of this particular subthread is that w

Re: User documentation vs Official Docs

2018-07-20 Thread George Neuner
On Thu, 19 Jul 2018 21:02:16 -0400, Melvin Davidson wrote: >As universities DO NOT ALLOW software to be installed on shared computers, >and this is the case especially in a library, it implies the user has >their own computer. Many (most?) universities do allow students to install and run soft

Re: sql questions

2018-07-20 Thread Brian Dunavant
On Fri, Jul 20, 2018 at 4:27 AM wrote: > > b) can a sql function return the count of affected rows of some query? > create function merge_names(int, int) returns void as > $_$ > update namelinks set nid = $2 where nid = $1; > -- want the affected rows of the above query > delete from names where

Re: sql questions

2018-07-20 Thread Thiemo Kellner
Zitat von haman...@t-online.de: a) I am running some select query select ... order by Now, I would like to preserver the ordering through further processing by adding a sequence number Of course I can do: create temp sequence mseq; select xx.*, nextval('mseq') as ord from (select ... ord

Re: sql questions

2018-07-20 Thread Laurenz Albe
haman...@t-online.de wrote: > a) I am running some select query > select ... order by > Now, I would like to preserver the ordering through further processing by > adding a sequence number > Of course I can do: > create temp sequence mseq; > select xx.*, nextval('mseq') as ord from (select ..

sql questions

2018-07-20 Thread hamann . w
Hi, a) I am running some select query select ... order by Now, I would like to preserver the ordering through further processing by adding a sequence number Of course I can do: create temp sequence mseq; select xx.*, nextval('mseq') as ord from (select ... order by ) xx; drop sequence