Re: How to write such a query

2020-09-18 Thread Adrian Klaver
On 9/18/20 1:18 PM, Igor Korot wrote: Hi, Ken, On Fri, Sep 18, 2020 at 2:46 PM Ken Tanzer > wrote: > How to find what the primary key (or UNIQUE identifier) value is > for row 5 in the recordset? You're missing the point: as mentioned bef

Re: How to write such a query

2020-09-18 Thread Ken Tanzer
On Fri, Sep 18, 2020 at 3:09 PM Igor Korot wrote: > > Now one other little thing: could you point me to the documentation that > explains the meaning of the "window function"? > Can I point you to Google instead? https://www.google.com/search?q=postgresql+window+functions Cheers, Ken -- AG

Re: How to write such a query

2020-09-18 Thread Igor Korot
Ken, On Fri, Sep 18, 2020 at 3:35 PM Ken Tanzer wrote: > On Fri, Sep 18, 2020 at 1:26 PM Ron wrote: > >> On 9/18/20 3:18 PM, Igor Korot wrote: >> > Thank you for the info. >> My problem is that I want to emulate Access behavior. >> >> As I said - Access does it without changing the query intern

Re: How to write such a query

2020-09-18 Thread David G. Johnston
On Fri, Sep 18, 2020 at 1:18 PM Igor Korot wrote: > As I said - Access does it without changing the query internally (I > presume). > > I want to do the same with PostgreSQL. > I suspect they basically do the equivalent of: UPDATE ... WHERE CURRENT OF ; https://www.postgresql.org/docs/12/sql-u

Re: How to write such a query

2020-09-18 Thread Ken Tanzer
On Fri, Sep 18, 2020 at 1:26 PM Ron wrote: > On 9/18/20 3:18 PM, Igor Korot wrote: > Thank you for the info. > My problem is that I want to emulate Access behavior. > > As I said - Access does it without changing the query internally (I > presume). > > I want to do the same with PostgreSQL. > > I

Re: How to write such a query

2020-09-18 Thread Ron
On 9/18/20 3:18 PM, Igor Korot wrote: Hi, Ken, On Fri, Sep 18, 2020 at 2:46 PM Ken Tanzer > wrote: > How to find what the primary key (or UNIQUE identifier) value is > for row 5 in the recordset? You're missing the point: as mentioned befor

Re: How to write such a query

2020-09-18 Thread Thomas Kellerer
Igor Korot schrieb am 18.09.2020 um 22:18: Thank you for the info. My problem is that I want to emulate Access behavior. As I said - Access does it without changing the query internally (I presume). I want to do the same with PostgreSQL. I'm just trying to understand how to make it work for an

Re: How to write such a query

2020-09-18 Thread Igor Korot
Hi, Ken, On Fri, Sep 18, 2020 at 2:46 PM Ken Tanzer wrote: > > How to find what the primary key (or UNIQUE identifier) value is >> > for row 5 in the recordset? >> >> You're missing the point: as mentioned before, there is no "row 5". To >> update the 5th record that you've fetched, you incremen

Re: How to write such a query

2020-09-18 Thread Rob Sargent
> On Sep 18, 2020, at 1:45 PM, Ken Tanzer wrote: > > > How to find what the primary key (or UNIQUE identifier) value is > > for row 5 in the recordset? > > You're missing the point: as mentioned before, there is no "row 5". To > update the 5th record that you've fetched, you increment a count

Re: How to write such a query

2020-09-18 Thread Ken Tanzer
> > > How to find what the primary key (or UNIQUE identifier) value is > > for row 5 in the recordset? > > You're missing the point: as mentioned before, there is no "row 5". To > update the 5th record that you've fetched, you increment a counter each > time > you fetch a row, and when you read #5,

Re: How to write such a query

2020-09-18 Thread Ron
On 9/18/20 1:49 PM, Igor Korot wrote: Hi, Adrian, On Fri, Sep 18, 2020 at 12:58 PM Adrian Klaver wrote: On 9/18/20 10:46 AM, Igor Korot wrote: Hi, Johnathan, On Fri, Sep 18, 2020 at 12:34 PM Jonathan Strong mailto:jonathanrstr...@gmail.com>> wrote: Are you looking to arbitrarily update

Re: How to write such a query

2020-09-18 Thread Jonathan Strong
A pretty good read / intro to the concept of keys in the relational model: https://www.red-gate.com/simple-talk/sql/learn-sql-server/primary-key-primer-for-sql-server/ - Jon *Jonathan Strong* CIO / CTO / Consultant *P:

Re: How to write such a query

2020-09-18 Thread Adrian Klaver
On 9/18/20 11:49 AM, Igor Korot wrote: Hi, Adrian, On Fri, Sep 18, 2020 at 12:58 PM Adrian Klaver wrote: On 9/18/20 10:46 AM, Igor Korot wrote: Hi, Johnathan, On Fri, Sep 18, 2020 at 12:34 PM Jonathan Strong mailto:jonathanrstr...@gmail.com>> wrote: Are you looking to arbitrarily upda

Re: How to write such a query

2020-09-18 Thread Igor Korot
Hi, Adrian, On Fri, Sep 18, 2020 at 12:58 PM Adrian Klaver wrote: > > On 9/18/20 10:46 AM, Igor Korot wrote: > > Hi, Johnathan, > > > > On Fri, Sep 18, 2020 at 12:34 PM Jonathan Strong > > mailto:jonathanrstr...@gmail.com>> wrote: > > > > Are you looking to arbitrarily update the field in the

Re: How to write such a query

2020-09-18 Thread Jonathan Strong
Yes...absolutely. Short of using ORDER BY, the order of a multi-row result set can be arbitrary, with "row position" having no significant meaning. This gets back to understanding set theory, the relational model, the various types of keys (primary, candidate, foreign, etc.). Truly crucial to unde

Re: How to write such a query

2020-09-18 Thread Jonathan Strong
Yes - 100% - Jon *Jonathan Strong* CIO / CTO / Consultant *P:* 609-532-1715 *E:* jonathanrstr...@gmail.com *Quora Top Writer * On Fri, Sep 18, 2020 at 2:22 PM Adrian K

Re: How to write such a query

2020-09-18 Thread Adrian Klaver
On 9/18/20 11:13 AM, Jonathan Strong wrote: @Adrian - Using a unique key value or otherwise isolating a specific record via selection against values in its attributes is certainly preferable to choosing a row to update via its position in a result set, unless the use case actually makes use o

Re: How to write such a query

2020-09-18 Thread Thomas Kellerer
Igor Korot schrieb am 18.09.2020 um 19:29: [code] CREATE TABLE X(id INTEGER PRIMARY KEY, field1 char(50), field2 int); CREATE TABLE Y(id INTEGER PRIMARY KEY, field1 char, field2 double(10, 2)); SELECT X.field1, Y.field2 from X, Y WHERE X.id = Y.id; [/code] Assuming that the SELECT return 10 rows

Re: How to write such a query

2020-09-18 Thread Jonathan Strong
@Adrian - Using a unique key value or otherwise isolating a specific record via selection against values in its attributes is certainly preferable to choosing a row to update via its position in a result set, unless the use case actually makes use of that position info as a meaningful descriptor o

Re: How to write such a query

2020-09-18 Thread Adrian Klaver
On 9/18/20 10:46 AM, Igor Korot wrote: Hi, Johnathan, On Fri, Sep 18, 2020 at 12:34 PM Jonathan Strong mailto:jonathanrstr...@gmail.com>> wrote: Are you looking to arbitrarily update the field in the fifth row, or can the row that needs to be updated be isolated by some add'l attr

Re: How to write such a query

2020-09-18 Thread Igor Korot
Hi, Johnathan, On Fri, Sep 18, 2020 at 12:34 PM Jonathan Strong wrote: > Are you looking to arbitrarily update the field in the fifth row, or can > the row that needs to be updated be isolated by some add'l attribute? > What's the use case? > What do you mean? I don't have any other attributes.

Re: How to write such a query

2020-09-18 Thread Igor Korot
Hi, Paul On Fri, Sep 18, 2020 at 12:34 PM Paul Förster wrote: > > Hi Igor, > > > On 18. Sep, 2020, at 19:29, Igor Korot wrote: > > > > Hi, > > Consider following > > > > [code] > > CREATE TABLE X(id INTEGER PRIMARY KEY, field1 char(50), field2 int); > > CREATE TABLE Y(id INTEGER PRIMARY KEY, fie

Re: How to write such a query

2020-09-18 Thread Paul Förster
Hi Igor, > On 18. Sep, 2020, at 19:29, Igor Korot wrote: > > Hi, > Consider following > > [code] > CREATE TABLE X(id INTEGER PRIMARY KEY, field1 char(50), field2 int); > CREATE TABLE Y(id INTEGER PRIMARY KEY, field1 char, field2 double(10, 2)); > SELECT X.field1, Y.field2 from X, Y WHERE X.id =

Re: How to write such a query

2020-09-18 Thread Jonathan Strong
Are you looking to arbitrarily update the field in the fifth row, or can the row that needs to be updated be isolated by some add'l attribute? What's the use case? - Jon *Jonathan Strong* CIO / CTO / Consultant *P:* 609

How to write such a query

2020-09-18 Thread Igor Korot
Hi, Consider following [code] CREATE TABLE X(id INTEGER PRIMARY KEY, field1 char(50), field2 int); CREATE TABLE Y(id INTEGER PRIMARY KEY, field1 char, field2 double(10, 2)); SELECT X.field1, Y.field2 from X, Y WHERE X.id = Y.id; [/code] Assuming that the SELECT return 10 rows, I want to update X.

Re: multiple tables got corrupted

2020-09-18 Thread Jerry Sievers
Vasu Madhineni writes: > Hi Magnus, > > Thanks for your update. > To identify the number of tables corrupted in the database if I run > below command, Will any impact on other tables in the production > environment.  > > "pg_dump -f /dev/null database" Consider using pg_dump or any other means t

Re: multiple tables got corrupted

2020-09-18 Thread Vasu Madhineni
Hi Magnus, Thanks for your update. To identify the number of tables corrupted in the database if I run below command, Will any impact on other tables in the production environment. "pg_dump -f /dev/null database" Thanks in advance. Regards, Vasu Madhineni On Fri, Sep 18, 2020 at 3:42 PM Magnus

Re: multiple tables got corrupted

2020-09-18 Thread Magnus Hagander
That depends on what the problem is and how they fix it. Most likely yes -- especially since if you haven't enabled data checksums you won't *know* if things are OK or not. So I'd definitely recommend it even if things *look* OK. //Magnus On Wed, Sep 16, 2020 at 5:06 AM Vasu Madhineni wrote: >

Re: PostgreSQL processes use large amount of private memory on Windows

2020-09-18 Thread Øystein Kolsrud
On Thu, Sep 17, 2020 at 7:27 PM Peter J. Holzer wrote: > What I would do: > > * Set log_statement to all (warning: that can be a lot of log messages. > It can also be a privacy/security hazard, depending on who has access > to the server and how sensitive queries are). > * Frequently (at lea