Re: Can't connect to server

2023-03-18 Thread Romain Mazière - SIGMAZ Consilium
Hi,

As I can see in the error message :
"localhost" (::1), port 5432 failed: FATAL: password authentication failed for 
user "postgres"."
Pgadmin4 try to connect via the loopback in IPv6 (::1) and fail for postgres 
user.
Have a look to pg_hba.conf, the file which describes access to postgres cluster.

Le 18 mars 2023 07:10:47 GMT+01:00, "Wu, Abigaile"  a écrit :
>I am writing to seek your assistance with a problem I am facing while using 
>pgAdmin4. After downloading the PostgreSQL 15, I downloaded the latest version 
>of Pgadmin 4 and then I click the server and choose PostgreSQL 15. Whenever I 
>try to log in to the server after entering my password, I receive the 
>following error message:
>
>"Connection to server at "localhost"(::1), port 5432 failed: could not 
>initiate GSSAPI security context: The operation or option is not available: 
>credential handle connection to server at "localhost" (::1), port 5432 failed: 
>FATAL: password authentication failed for user "postgres"."
>
>Could you please advise me on how to resolve this issue? I would be grateful 
>if you could provide me with any instructions or guidance on what steps I can 
>take to fix this problem and gain access to the server.
>
>Thank you for your time and assistance. I look forward to hearing from you 
>soon.
>
>
>[cid:a456724f-1d8d-4cd9-ba3c-81dd950f3723]
>
>Abigaile Wu
>
>Pronouns: She/Her/Hers
>
>Full-Time MBA Candidate 2023
>
>Graduate Assistant - Admission Team
>
>Broad College of Business
>
>Michigan State University
>
>C: (517) 329 - 5793
>
>E: wuchi...@msu.edu
>
>
>
>WHO WILL MAKE BUSINESS HAPPEN?
>
>SPARTANS WILL.
>


Re: Delete values from JSON

2023-03-18 Thread Boris Zentner


> Am 17.03.2023 um 08:56 schrieb Andreas Joseph Krogh :
> 
> Hi, in PG-14, how do I delete the keys "dunsNumber": "NaN":
>  
> {
>   "sessionId": "ce6fc9d0-5923-4d71-9f7e-ae60f35c45d6",
>   "details": [
> {
>   "keyInformation": {
> "dunsNumber": "NaN",
> "organizationType": "LIMITED_COMPANY"
>   }
> },
> {
>   "keyInformation": {
> "dunsNumber": "123",
> "organizationType": "LIMITED_COMPANY"
>   }
> }
>   ],
>   "nisse": 123
> }
>  
> So that the result becomes:
>  
> {
>   "sessionId": "ce6fc9d0-5923-4d71-9f7e-ae60f35c45d6",
>   "details": [
> {
>   "keyInformation": {
> "organizationType": "LIMITED_COMPANY"
>   }
> },
> {
>   "keyInformation": {
> "dunsNumber": "123",
> "organizationType": "LIMITED_COMPANY"
>   }
> }
>   ],
>   "nisse": 123
> }
>  
> Thanks.

Hi Andreas, this works for me.

➤ 2023-03-18 14:23:51 CET bz@[local]:5432/test
=# WITH data(j)
  AS (VALUES (CAST('{ "sessionId": "ce6fc9d0-5923-4d71-9f7e-ae60f35c45d6", 
"details": [ { "keyInformation": { "dunsNumber": "NaN", "organizationType": 
"LIMITED_COMPANY" } }, { "keyInformation": { "dunsNumber": "123", 
"organizationType": "LIMITED_COMPANY" } } ], "nisse": 123 }' AS jsonb)))

  SELECT jsonb_pretty(jsonb_set(j
  , '{details}'
  , (SELECT jsonb_agg(CASE
WHEN ((elem -> 
'keyInformation') ->> 'dunsNumber') = 'NaN'
  THEN jsonb_set(elem
   , 
'{keyInformation}'
   , (elem -> 
'keyInformation') - 'dunsNumber')
ELSE elem
  END)
 FROM jsonb_array_elements(data.j -> 'details') 
AS elem))) AS nice_output
  FROM data
;
nice_output
{
"nisse": 123,
"details": [
{
"keyInformation": {
"organizationType": "LIMITED_COMPANY"
}
},
{
"keyInformation": {
"dunsNumber": "123",
"organizationType": "LIMITED_COMPANY"
}
}
],
"sessionId": "ce6fc9d0-5923-4d71-9f7e-ae60f35c45d6"
}
(1 row)
Time: 0,731 ms

--
Boris




Re: Can't connect to server

2023-03-18 Thread Adrian Klaver

On 3/17/23 23:10, Wu, Abigaile wrote:
I am writing to seek your assistance with a problem I am facing while 
using pgAdmin4. After downloading the PostgreSQL 15, I downloaded the 
latest version of Pgadmin 4 and then I click the server and choose 
PostgreSQL 15. Whenever I try to log in to the server after entering my 
password, I receive the following error message:


"Connection to server at "localhost"(::1), port 5432 failed: could not 
initiate GSSAPI security context: The operation or option is not 
available: credential handle connection to server at "localhost" (::1), 
port 5432 failed: FATAL: password authentication failed for user 
"postgres"."


Could you please advise me on how to resolve this issue? I would be 
grateful if you could provide me with any instructions or guidance on 
what steps I can take to fix this problem and gain access to the server.


OS and version?

Where did you install Postgres 15 from?

Where did you install pgAdmin4 from?

What are the contents of your pg_hba.conf file?



Thank you for your time and assistance. I look forward to hearing from 
you soon.


*Abigaile Wu*

Pronouns: She/Her/Hers

*Full-Time MBA Candidate 2023*

*Graduate Assistant - Admission Team
*

Broad College of Business

Michigan State University

*C*: (517) 329 - 5793

*E*: wuchi...@msu.edu

*WHO WILL MAKE BUSINESS HAPPEN?*

*SPARTANS WILL.*




--
Adrian Klaver
adrian.kla...@aklaver.com





Re: Delete values from JSON

2023-03-18 Thread Andreas Joseph Krogh


Excellent!
Thanks!

På lørdag 18. mars 2023 kl. 14:26:57, skrev Boris Zentner mailto:b...@2bz.de>>:







Am 17.03.2023 um 08:56 schrieb Andreas Joseph Krogh :





Hi, in PG-14, how do I delete the keys "dunsNumber": "NaN":

{ "sessionId": "ce6fc9d0-5923-4d71-9f7e-ae60f35c45d6", "details": [ { 
"keyInformation": { "dunsNumber": "NaN", "organizationType": "LIMITED_COMPANY" 
} }, { "keyInformation": { "dunsNumber": "123", "organizationType": 
"LIMITED_COMPANY" } } ], "nisse": 123 }


So that the result becomes:

{ "sessionId": "ce6fc9d0-5923-4d71-9f7e-ae60f35c45d6", "details": [ { 
"keyInformation": { "organizationType": "LIMITED_COMPANY" } }, { 
"keyInformation": { "dunsNumber": "123", "organizationType": "LIMITED_COMPANY" 
} } ], "nisse": 123 }


Thanks.



Hi Andreas, this works for me.



➤ 2023-03-18 14:23:51 CET bz@[local]:5432/test
=# WITH data(j)
 AS (VALUES (CAST('{ "sessionId": "ce6fc9d0-5923-4d71-9f7e-ae60f35c45d6", 
"details": [ { "keyInformation": { "dunsNumber": "NaN", "organizationType": 
"LIMITED_COMPANY" } }, { "keyInformation": { "dunsNumber": "123", 
"organizationType": "LIMITED_COMPANY" } } ], "nisse": 123 }' AS jsonb)))

 SELECT jsonb_pretty(jsonb_set(j
 , '{details}'
 , (SELECT jsonb_agg(CASE
 WHEN ((elem -> 'keyInformation') ->> 'dunsNumber') = 'NaN'
 THEN jsonb_set(elem
 , '{keyInformation}'
 , (elem -> 'keyInformation') - 'dunsNumber')
 ELSE elem
 END)
 FROM jsonb_array_elements(data.j -> 'details') AS elem))) AS nice_output
 FROM data
;
nice_output
{
 "nisse": 123,
 "details": [
 {
 "keyInformation": {
 "organizationType": "LIMITED_COMPANY"
 }
 },
 {
 "keyInformation": {
 "dunsNumber": "123",
 "organizationType": "LIMITED_COMPANY"
 }
 }
 ],
 "sessionId": "ce6fc9d0-5923-4d71-9f7e-ae60f35c45d6"
}
(1 row)
Time: 0,731 ms

--
Boris











--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
andr...@visena.com 
www.visena.com 
 


Getting error while upgrading postgres from version 12 to 13

2023-03-18 Thread shashidhar Reddy
Hello,

I am in a process of upgrading postgresql from version 12 to 13 using
pg_upgrdrade but I am getting error stating

 FATAL:  database files are incompatible with server
 DETAIL:  The data directory was initialized by PostgreSQL version 13
, which is not compatible with this version 12.14 (Ubuntu
12.14-1.pgdg18.04+1)

Please help me on this issue.
-- 
Shashidhar


Re: Getting error while upgrading postgres from version 12 to 13

2023-03-18 Thread Ron

On 3/18/23 15:39, shashidhar Reddy wrote:

Hello,

I am in a process of upgrading postgresql from version 12 to 13 using 
pg_upgrdrade but I am getting error stating


 FATAL:  database files are incompatible with server
 DETAIL:  The data directory was initialized by PostgreSQL version 13
, which is not compatible with this version 12.14 (Ubuntu 12.14-1.pgdg18.04+1)

Please help me on this issue.


Show us the complete command you ran, pus all output.

--
Born in Arizona, moved to Babylonia.




Re: Getting error while upgrading postgres from version 12 to 13

2023-03-18 Thread shashidhar Reddy
and adding to this the following is also showing in the error, we tried
changing the file permissions but still no luck
FATAL:  could not load private key file
"/etc/ssl/private/ssl-cert-snakeoil.key": key values mismatch

On Sun, Mar 19, 2023 at 2:09 AM shashidhar Reddy <
shashidharreddy...@gmail.com> wrote:

> Hello,
>
> I am in a process of upgrading postgresql from version 12 to 13 using
> pg_upgrdrade but I am getting error stating
>
>  FATAL:  database files are incompatible with server
>  DETAIL:  The data directory was initialized by PostgreSQL version 13
> , which is not compatible with this version 12.14 (Ubuntu
> 12.14-1.pgdg18.04+1)
>
> Please help me on this issue.
> --
> Shashidhar
>


-- 
Shashidhar


Re: Getting error while upgrading postgres from version 12 to 13

2023-03-18 Thread Tomas Pospisek

On 18.03.23 22:24, shashidhar Reddy wrote:
and adding to this the following is also showing in the error, we tried 
changing the file permissions but still no luck
FATAL:  could not load private key file 
"/etc/ssl/private/ssl-cert-snakeoil.key": key values mismatch


This sounds like the private SSL key you have configured is not the 
private key for the public key you have configured - they do not match.

*t





Re: Getting error while upgrading postgres from version 12 to 13

2023-03-18 Thread Tomas Pospisek
On Sun, Mar 19, 2023 at 2:09 AM shashidhar Reddy 
mailto:shashidharreddy...@gmail.com>> wrote:


Hello,

I am in a process of upgrading postgresql from version 12 to 13
using pg_upgrdrade but I am getting error stating

  FATAL:  database files are incompatible with server
  DETAIL:  The data directory was initialized by PostgreSQL version 13
, which is not compatible with this version 12.14 (Ubuntu
12.14-1.pgdg18.04+1)

Please help me on this issue.


You have configured the postgres v12 server to use a directory where 
there are data from a postgres v13 server. Evidently that can not work...

*t





Re: Can't connect to server

2023-03-18 Thread Jeff Janes
On Sat, Mar 18, 2023 at 2:11 AM Wu, Abigaile  wrote:

> I am writing to seek your assistance with a problem I am facing while
> using pgAdmin4. After downloading the PostgreSQL 15, I downloaded the
> latest version of Pgadmin 4 and then I click the server and choose
> PostgreSQL 15. Whenever I try to log in to the server after entering my
> password, I receive the following error message:
>
> "Connection to server at "localhost"(::1), port 5432 failed: could not
> initiate GSSAPI security context: The operation or option is not available:
> credential handle
>

This is probably just a nuisance message.  It thought it might be able to
authenticate via Kerberos and so tried that one first, but discovered it
couldn't. Unless you know that that is what you were trying to do, you can
ignore it.


> connection to server at "localhost" (::1), port 5432 failed: FATAL:
> password authentication failed for user "postgres"."
>

Look in the database server's log files to see if there are more details
about this authentication error.  When you set up the system, is "postgres"
the name you picked for the admin user?  That is the default and most
common, but you could have changed it if you wanted to.

Cheers,

Jeff


Re: Properly handle OOM death?

2023-03-18 Thread Tomas Pospisek

On 13.03.23 21:25, Joe Conway wrote:

Hmm, well big +1 for having swap turned on, but I recommend setting 
"vm.overcommit_memory=2" even so.


I've snipped out the context here, since my advice is very unspecific: 
do use swap only as a safety net. Once your system starts swapping 
performance goes down the toilet.

*t





Re: Properly handle OOM death?

2023-03-18 Thread Jeffrey Walton
On Sat, Mar 18, 2023 at 6:02 PM Tomas Pospisek  wrote:
>
> On 13.03.23 21:25, Joe Conway wrote:
>
> > Hmm, well big +1 for having swap turned on, but I recommend setting
> > "vm.overcommit_memory=2" even so.
>
> I've snipped out the context here, since my advice is very unspecific:
> do use swap only as a safety net. Once your system starts swapping
> performance goes down the toilet.

To use swap as a safety net, set swappiness to a low value, like 2.
Two will keep most data in RAM and reduce (but not eliminate) spilling
to the file system.

I have a bunch of old ARM dev boards that are resource constrained.
They use SDcards, which have a limited lifetime based on writes. I
give the boards a 1 GB swap file to avoid OOM kills when running the
compiler on C++ programs. And I configure them with a swappiness of 2
to reduce swapping.

Jeff




Re: Getting error while upgrading postgres from version 12 to 13

2023-03-18 Thread shashidhar Reddy
Can someone please help me with this?

On Sun, 19 Mar, 2023, 2:54 am shashidhar Reddy, <
shashidharreddy...@gmail.com> wrote:

> and adding to this the following is also showing in the error, we tried
> changing the file permissions but still no luck
> FATAL:  could not load private key file
> "/etc/ssl/private/ssl-cert-snakeoil.key": key values mismatch
>
> On Sun, Mar 19, 2023 at 2:09 AM shashidhar Reddy <
> shashidharreddy...@gmail.com> wrote:
>
>> Hello,
>>
>> I am in a process of upgrading postgresql from version 12 to 13 using
>> pg_upgrdrade but I am getting error stating
>>
>>  FATAL:  database files are incompatible with server
>>  DETAIL:  The data directory was initialized by PostgreSQL version 13
>> , which is not compatible with this version 12.14 (Ubuntu
>> 12.14-1.pgdg18.04+1)
>>
>> Please help me on this issue.
>> --
>> Shashidhar
>>
>
>
> --
> Shashidhar
>


Re: Getting error while upgrading postgres from version 12 to 13

2023-03-18 Thread Adrian Klaver

On 3/18/23 19:26, shashidhar Reddy wrote:

Can someone please help me with this?


You have already been helped:

https://www.postgresql.org/message-id/ba59dd9b-6a87-ebff-c041-2dbcffe74a89%40sourcepole.ch

"You have configured the postgres v12 server to use a directory where
there are data from a postgres v13 server. Evidently that can not work..."



On Sun, 19 Mar, 2023, 2:54 am shashidhar Reddy, 
mailto:shashidharreddy...@gmail.com>> wrote:


and adding to this the following is also showing in the error, we
tried changing the file permissions but still no luck
FATAL:  could not load private key file
"/etc/ssl/private/ssl-cert-snakeoil.key": key values mismatch

On Sun, Mar 19, 2023 at 2:09 AM shashidhar Reddy
mailto:shashidharreddy...@gmail.com>>
wrote:

Hello,

I am in a process of upgrading postgresql from version 12 to 13
using pg_upgrdrade but I am getting error stating

  FATAL:  database files are incompatible with server
  DETAIL:  The data directory was initialized by PostgreSQL
version 13
, which is not compatible with this version 12.14 (Ubuntu
12.14-1.pgdg18.04+1)

Please help me on this issue.
-- 
Shashidhar




-- 
Shashidhar




--
Adrian Klaver
adrian.kla...@aklaver.com





Re: Getting error while upgrading postgres from version 12 to 13

2023-03-18 Thread David G. Johnston
On Sat, Mar 18, 2023 at 7:27 PM shashidhar Reddy <
shashidharreddy...@gmail.com> wrote:

> Can someone please help me with this?
>
>>
>>
You haven't given others enough information to help you.  Present to the
fullest extent possible your current environment and the commands you are
running.  Showing that psql itself works on both running clusters would be
a good start.  Show inputs, not just outputs those inputs creates.

David J.