Thread: Re: Corruption of few tables

Re: Corruption of few tables

From
"sivapostgres@yahoo.com"
Date:
Hello,

Using PostgreSQL 11.11, compiled by Visual C++ build 1914, 64-bit  with Powerbuilder 

Recently, in one of our customers' places, we got an error while saving a record from our custom-built application using PowerBuilder.     While saving a record, we compare a value from a table with a hard-coded value in application.  Here the select command failed to fetch that particular record from the table and so the save failed.

When we tried to read data from randomly selected tables [ from PGAdmin], we found that records could not be read from a set of consecutive tables. We re-started server [ Windows Server 2012 ] and tried again to read those tables.  This time the failure was with only one table and select was success in all other tables.  

So we dropped that particular table [ around 33000 records ], after removing all foreign key links and re-created that table and inserted all records from a backup set.

The problem got solved.  Since this is not the first time, we are getting this error, I want to know

1.  Why is corruption happening?  How to find out the reason?
2.  What should I do to prevent this from happening again?

Any steps or suggestions to avoid such corruptions is really appreciated.

Happiness Always
BKR Sivaprakash

Re: Corruption of few tables

From
o1bigtenor
Date:
On Tue, Feb 25, 2025 at 6:03 AM sivapostgres@yahoo.com
<sivapostgres@yahoo.com> wrote:
>
> Hello,
>
> Using PostgreSQL 11.11, compiled by Visual C++ build 1914, 64-bit  with Powerbuilder
>
> Recently, in one of our customers' places, we got an error while saving a record from our custom-built application
usingPowerBuilder.     While saving a record, we compare a value from a table with a hard-coded value in application.
Herethe select command failed to fetch that particular record from the table and so the save failed. 
>
> When we tried to read data from randomly selected tables [ from PGAdmin], we found that records could not be read
froma set of consecutive tables. We re-started server [ Windows Server 2012 ] and tried again to read those tables.
Thistime the failure was with only one table and select was success in all other tables. 
>
> So we dropped that particular table [ around 33000 records ], after removing all foreign key links and re-created
thattable and inserted all records from a backup set. 
>
> The problem got solved.  Since this is not the first time, we are getting this error, I want to know
>
> 1.  Why is corruption happening?  How to find out the reason?
> 2.  What should I do to prevent this from happening again?
>
> Any steps or suggestions to avoid such corruptions is really appreciated.
>
Not really a direct answer - - - but - - - have you considered
updating Postgresql.
Version 11 was EOL (end of life) over a year ago. Version 17 according
to the charts I've found
is the current version.

HTH



Re: Corruption of few tables

From
Greg Sabino Mullane
Date:
On Tue, Feb 25, 2025 at 7:03 AM sivapostgres@yahoo.com <sivapostgres@yahoo.com> wrote:
1.  Why is corruption happening?  How to find out the reason?

It sounds more like user error than actual corruption, but without more data we cannot determine. Show us the exact commands you ran, along with the results you expected to see, and the results you got. Provide as much detail as possible. A reproducible test case would be ideal.

Happiness Always

That is an excellent valediction, thanks for that.

Cheers,
Greg

--
Enterprise Postgres Software Products & Tech Support

Re: Corruption of few tables

From
Adrian Klaver
Date:
On 2/25/25 04:39, o1bigtenor wrote:
> On Tue, Feb 25, 2025 at 6:03 AM sivapostgres@yahoo.com

> Not really a direct answer - - - but - - - have you considered
> updating Postgresql.
> Version 11 was EOL (end of life) over a year ago. Version 17 according
> to the charts I've found
> is the current version.

Actually the current community supported versions are 13-17.

The time lines for support can be found here:

https://www.postgresql.org/support/versioning/

> 
> HTH
> 
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com




Re: Corruption of few tables

From
"sivapostgres@yahoo.com"
Date:
Thanks

// Following is the PB code to retrieve data

ls_pack_version = fn_get_product_version()
ls_pack_build   = fn_get_product_build()

Select releasenumber, buildnumber
Into   :ls_db_version, :ls_db_build
From   public.co_version
Where  modulename = 'ALL';
If SQLCA.sqlcode <> 0 Then
    ls_db_version = ''
    ls_db_build   = 'base'
End If

If ls_pack_version <> ls_db_version Then
   as_msg   = 'Version do not match.~r~nDB Ver : ' + ls_db_version
   as_msg += '      Build : ' + ls_db_build
   as_msg += '~r~nPack.Ver : ' + ls_pack_version
   as_msg += '      Build : ' + ls_pack_build
   as_msg += '~r~nPlease upgrade Program or Database'
   Messagebox('Error' as_msg)
   Return False
End If

We get the above message [ Version do not match .... ], as SQLCA.Sqlcode returned is not ZERO.  [ Successful read will return ZERO ]

We tried selecting tables from PGAdmin also, where we got Disconnected from the Server...  error message.

On Tuesday 25 February, 2025 at 07:02:40 pm IST, Greg Sabino Mullane <htamfids@gmail.com> wrote:


On Tue, Feb 25, 2025 at 7:03 AM sivapostgres@yahoo.com <sivapostgres@yahoo.com> wrote:
1.  Why is corruption happening?  How to find out the reason?

It sounds more like user error than actual corruption, but without more data we cannot determine. Show us the exact commands you ran, along with the results you expected to see, and the results you got. Provide as much detail as possible. A reproducible test case would be ideal.

Happiness Always


That is an excellent valediction, thanks for that.

Cheers,
Greg

--
Enterprise Postgres Software Products & Tech Support

Re: Corruption of few tables

From
"sivapostgres@yahoo.com"
Date:
Yes, we are planning to upgrade to Ver 17 soon.
Yesterday, we got the similar error in one more client place where version 15 is running in Ubuntu Server.   We are trying to figure out whether it's a network issue or corruption issue.   

On Tuesday 25 February, 2025 at 08:24:44 pm IST, Adrian Klaver <adrian.klaver@aklaver.com> wrote:


On 2/25/25 04:39, o1bigtenor wrote:
> On Tue, Feb 25, 2025 at 6:03 AM sivapostgres@yahoo.com

> Not really a direct answer - - - but - - - have you considered
> updating Postgresql.
> Version 11 was EOL (end of life) over a year ago. Version 17 according
> to the charts I've found
> is the current version.

Actually the current community supported versions are 13-17.

The time lines for support can be found here:

https://www.postgresql.org/support/versioning/


>
> HTH

>
>

--
Adrian Klaver
adrian.klaver@aklaver.com




Re: Corruption of few tables

From
"sivapostgres@yahoo.com"
Date:
Since we rectified the issue in ver 11, I couldn't get more details.   

Now we are getting the same [ or similar ] issue in PostgreSQL 15.7 (Ubuntu 15.7-1.pgdg24.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0, 64-bit

When we ran the following query, in PGAdmin

Select releasenumber, buildnumber
From   public.co_version
Where  modulename = 'ALL';

We got the following error
ERROR: SSL error: bad length
SSL SYSCALL error: No error (0x00000000/0)

When we try to run the same above query by opening another window [ same PGAdmin, in another window ], we get correct expected result and NOT the error.

Couldn't identify whether this is related to network or corruption.  

Happiness Always
BKR Sivaprakash

On Wednesday 26 February, 2025 at 12:07:00 pm IST, sivapostgres@yahoo.com <sivapostgres@yahoo.com> wrote:


Yes, we are planning to upgrade to Ver 17 soon.
Yesterday, we got the similar error in one more client place where version 15 is running in Ubuntu Server.   We are trying to figure out whether it's a network issue or corruption issue.   

On Tuesday 25 February, 2025 at 08:24:44 pm IST, Adrian Klaver <adrian.klaver@aklaver.com> wrote:


On 2/25/25 04:39, o1bigtenor wrote:
> On Tue, Feb 25, 2025 at 6:03 AM sivapostgres@yahoo.com

> Not really a direct answer - - - but - - - have you considered
> updating Postgresql.
> Version 11 was EOL (end of life) over a year ago. Version 17 according
> to the charts I've found
> is the current version.

Actually the current community supported versions are 13-17.

The time lines for support can be found here:

https://www.postgresql.org/support/versioning/


>
> HTH

>
>

--
Adrian Klaver
adrian.klaver@aklaver.com




Re: Corruption of few tables

From
Greg Sabino Mullane
Date:
On Wed, Feb 26, 2025 at 2:21 AM sivapostgres@yahoo.com <sivapostgres@yahoo.com> wrote: 
issue in PostgreSQL 15.7

Still missing a ton of bug fixes - Postgres 15 is on version 15.12. Try to get that upgraded.
 
We got the following error
ERROR: SSL error: bad length
SSL SYSCALL error: No error (0x00000000/0)

This is a network error, not data corruption. How much time passes from starting the query until you see the error? Make sure all your related programs are up to date (esp. pgadmin, openssl). Check the Postgres logs to see if there is more information or perhaps other information about why the SSL connection is failing.

Cheers,
Greg

--
Enterprise Postgres Software Products & Tech Support

Re: Corruption of few tables

From
Ron Johnson
Date:
On Wed, Feb 26, 2025 at 9:06 AM Greg Sabino Mullane <htamfids@gmail.com> wrote:
On Wed, Feb 26, 2025 at 2:21 AM sivapostgres@yahoo.com <sivapostgres@yahoo.com> wrote: 
issue in PostgreSQL 15.7

Still missing a ton of bug fixes - Postgres 15 is on version 15.12. Try to get that upgraded.

And it takes less than five minutes to stop the instance, install the packages then restart the instance.

--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!

Re: Corruption of few tables

From
Adrian Klaver
Date:
On 2/25/25 22:33, sivapostgres@yahoo.com wrote:
> Thanks
> 
> // Following is the PB code to retrieve data
> 
> ls_pack_version = fn_get_product_version()
> ls_pack_build   = fn_get_product_build()
> 
> Select releasenumber, buildnumber
> Into   :ls_db_version, :ls_db_build
> From   public.co_version
> Where  modulename = 'ALL';
> If SQLCA.sqlcode <> 0 Then
>      ls_db_version = ''
>      ls_db_build   = 'base'
> End If
> 
> If ls_pack_version <> ls_db_version Then
>     as_msg   = 'Version do not match.~r~nDB Ver : ' + ls_db_version
>     as_msg += '      Build : ' + ls_db_build
>     as_msg += '~r~nPack.Ver : ' + ls_pack_version
>     as_msg += '      Build : ' + ls_pack_build
>     as_msg += '~r~nPlease upgrade Program or Database'
>     Messagebox('Error' as_msg)
>     Return False
> End If
> 
> We get the above message [ Version do not match .... ], as SQLCA.Sqlcode 
> returned is not ZERO.  [ Successful read will return ZERO ]

Not sure how the two are connected.

The message is generated if:

ls_pack_version <> ls_db_version.

 From what I can see that depends on the results of:

ls_pack_version = fn_get_product_version()

and

Select releasenumber ...

as well as

If SQLCA.sqlcode <> 0

How do you what is actually leading to?:

ls_pack_version <> ls_db_version.


> 
> We tried selecting tables from PGAdmin also, where we got Disconnected 
> from the Server...  error message.
> 
> On Tuesday 25 February, 2025 at 07:02:40 pm IST, Greg Sabino Mullane 
> <htamfids@gmail.com> wrote:
> 
> 
> On Tue, Feb 25, 2025 at 7:03 AM sivapostgres@yahoo.com 
> <mailto:sivapostgres@yahoo.com> <sivapostgres@yahoo.com 
> <mailto:sivapostgres@yahoo.com>> wrote:
> 
>     1.  Why is corruption happening?  How to find out the reason?
> 
> 
> It sounds more like user error than actual corruption, but without more 
> data we cannot determine. Show us the exact commands you ran, along with 
> the results you expected to see, and the results you got. Provide as 
> much detail as possible. A reproducible test case would be ideal.
> 
>     Happiness Always
> 
> 
> That is an excellent valediction, thanks for that.
> 
> Cheers,
> Greg
> 
> --
> Crunchy Data - https://www.crunchydata.com <https://www.crunchydata.com>
> Enterprise Postgres Software Products & Tech Support
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com




Re: Corruption of few tables

From
Adrian Klaver
Date:
On 2/25/25 23:21, sivapostgres@yahoo.com wrote:
> Since we rectified the issue in ver 11, I couldn't get more details.

What issue is this?:

ls_pack_version <> ls_db_version

or the SSL issue you show below?


> 
> Now we are getting the same [ or similar ] issue in PostgreSQL 15.7 
> (Ubuntu 15.7-1.pgdg24.04+1) on x86_64-pc-linux-gnu, compiled by gcc 
> (Ubuntu 13.2.0-23ubuntu4) 13.2.0, 64-bit
> 
> When we ran the following query, in PGAdmin

Is this all on one machine, between machines on same network, machines 
on different networks?

What version of pgAdmin?

What if you use psql?

> 
> Select releasenumber, buildnumber
> From   public.co_version
> Where  modulename = 'ALL';
> 
> We got the following error
> ERROR: SSL error: bad length
> SSL SYSCALL error: No error (0x00000000/0)
> 
> When we try to run the same above query by opening another window [ same 
> PGAdmin, in another window ], we get correct expected result and NOT the 
> error.
> 
> Couldn't identify whether this is related to network or corruption.
> 
> Happiness Always
> BKR Sivaprakash
> 
> On Wednesday 26 February, 2025 at 12:07:00 pm IST, 
> sivapostgres@yahoo.com <sivapostgres@yahoo.com> wrote:
> 
> 
> Yes, we are planning to upgrade to Ver 17 soon.
> Yesterday, we got the similar error in one more client place where 
> version 15 is running in Ubuntu Server.   We are trying to figure out 
> whether it's a network issue or corruption issue.
> 
> On Tuesday 25 February, 2025 at 08:24:44 pm IST, Adrian Klaver 
> <adrian.klaver@aklaver.com> wrote:
> 
> 
> On 2/25/25 04:39, o1bigtenor wrote:
>  > On Tue, Feb 25, 2025 at 6:03 AM sivapostgres@yahoo.com 
> <mailto:sivapostgres@yahoo.com>
> 
>  > Not really a direct answer - - - but - - - have you considered
>  > updating Postgresql.
>  > Version 11 was EOL (end of life) over a year ago. Version 17 according
>  > to the charts I've found
>  > is the current version.
> 
> Actually the current community supported versions are 13-17.
> 
> The time lines for support can be found here:
> 
> https://www.postgresql.org/support/versioning/ 
> <https://www.postgresql.org/support/versioning/>
> 
> 
>  >
>  > HTH
> 
>  >
>  >
> 
> -- 
> Adrian Klaver
> adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
> 
> 
> 
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com