Re: PLPGSQL - extra column existence in trigger

2022-05-09 Thread Durumdara
Dear David!

That was a very good idea! I have integrated it! :-)

Priorly I had another idea: I made a DDL to extend the table with "add
column if not exists" elements.
But what you suggested is better. Thank you!

Best wishes
dd

David G. Johnston  ezt írta (időpont: 2022.
máj. 7., Szo, 16:41):

> On Saturday, May 7, 2022, Durumdara  wrote:
>
>>
>>
>> So is there any syntax to not fall on missing columns?
>>
>
> No.  I’d probably approach this by generically converting the NEW record
> to json and working with that.  Non-existent object keys return null when
> accessed.
>
> David J.
>


Re: pg_dump: VACUUM and REINDEXING

2022-05-09 Thread Tom Lane
Laurenz Albe  writes:
> But from PostgreSQL v13 on, autovacuum is also triggered by INSERTs.
> So I'd say that there is nothing to do after restoring a pg_dump, except
> to wait until autovacuum is done.

You might want to do manual VACUUM ANALYZE (no need for FULL) if
you don't want to wait around for autovacuum to get to it.

regards, tom lane




Need to install Postgres Version 14 in Linux server with Client and migration steps.

2022-05-09 Thread Rajamoorthy-CW, Thirumurugan 8361
Hi Team,

I need to install Postgres Version 14 in Linux server with Client and migration 
steps. Can you please provide me the installation steps document ?



Regards
Thirumurugan Rajamoorthy - Biometrics Support



Re: Need to install Postgres Version 14 in Linux server with Client and migration steps.

2022-05-09 Thread Sandeep Kumar Jakkaraju
Please email it help desk

On Mon, 9 May 2022, 9:28 pm Rajamoorthy-CW, Thirumurugan 8361, <
thirumurugan.rajamoorthy...@otsuka-us.com> wrote:

> Hi Team,
>
>
>
> I need to install Postgres Version 14 in Linux server with Client and
> migration steps. Can you please provide me the installation steps document ?
>
>
>
>
>
>
>
> Regards
>
> Thirumurugan Rajamoorthy – Biometrics Support
>
>
>


Re: Need to install Postgres Version 14 in Linux server with Client and migration steps.

2022-05-09 Thread Alan Hodgson
On Mon, 2022-05-09 at 06:46 +, Rajamoorthy-CW, Thirumurugan 8361
wrote:
> Hi Team,
>  
> I need to install Postgres Version 14 in Linux server with Client
> and migration steps. Can you please provide me the installation
> steps document ?
> 

PostgreSQL is kind of a do-it-yourself thing like all open source. No
one is going to hand-hold you through all the steps of upgrading your
particular environment.

1) contact your DBA or ops team.
2) Ask them to upgrade PostgreSQL

If you are the DBA or ops team, the PostgreSQL documentation is
at https://www.postgresql.org/docs/current

Pay particular attention to the sections on Backup and Restore
and https://www.postgresql.org/docs/current/pgupgrade.html.

And I would recommend you build a test server and try it there a
couple of times first.

gl.


Re: Need to install Postgres Version 14 in Linux server with Client and migration steps.

2022-05-09 Thread Sandeep Kumar Jakkaraju
Sure, here it is.
ith...@bimetrics.in

On Mon, 9 May 2022, 9:39 pm Rajamoorthy-CW, Thirumurugan 8361, <
thirumurugan.rajamoorthy...@otsuka-us.com> wrote:

> What is the helpdesk email address ? please let me know.
>
>
>
>
>
>
>
>
>
>
>
>
>
> Regards
>
> Thirumurugan Rajamoorthy – Biometrics Support
>
>
>
> *From:* Sandeep Kumar Jakkaraju 
> *Sent:* Monday, May 9, 2022 12:08 PM
> *To:* Rajamoorthy-CW, Thirumurugan 8361 <
> thirumurugan.rajamoorthy...@otsuka-us.com>
> *Cc:* pgsql-general@lists.postgresql.org
> *Subject:* Re: Need to install Postgres Version 14 in Linux server with
> Client and migration steps.
>
>
>
> *WARNING:* This message originated outside of Otsuka.
> Do not click links or open attachments unless you recognize the sender and
> know the content is safe.
> If you believe the contents of this email may be unsafe report it
> immediately by clicking the *Phish Alert Button (PAB).*
>
> Please email it help desk
>
>
>
> On Mon, 9 May 2022, 9:28 pm Rajamoorthy-CW, Thirumurugan 8361, <
> thirumurugan.rajamoorthy...@otsuka-us.com> wrote:
>
> Hi Team,
>
>
>
> I need to install Postgres Version 14 in Linux server with Client and
> migration steps. Can you please provide me the installation steps document ?
>
>
>
>
>
>
>
> Regards
>
> Thirumurugan Rajamoorthy – Biometrics Support
>
>
>
>


Re: Need to install Postgres Version 14 in Linux server with Client and migration steps.

2022-05-09 Thread Adrian Klaver

On 5/8/22 23:46, Rajamoorthy-CW, Thirumurugan 8361 wrote:

Hi Team,

I need to install Postgres Version 14 in Linux server with Client and 
migration steps. Can you please provide me the installation steps document ?


You have not said what Linux distro, but here is link to installing 
software:


https://www.postgresql.org/download/

As to migrating that would need more information:

1) Migrating from what version of Postgres?

2) Migrate as?:
  a) Dump and then restore.
  OR
  b) pg_upgrade



Regards

Thirumurugan Rajamoorthy – Biometrics Support




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




Set timeout just on a query?

2022-05-09 Thread Shaozhong SHI
Can timeout be set just on a query?

Can we do the following?

Begin

do a query
set timeout
Exception
report a record

End;

Regards,
David


Re: Set timeout just on a query?

2022-05-09 Thread Bharath Rupireddy
On Tue, May 10, 2022 at 6:29 AM Shaozhong SHI  wrote:
>
>
> Can timeout be set just on a query?
>
> Can we do the following?
>
> Begin
>
> do a query
> set timeout
> Exception
> report a record
>
> End;

Won't the statement_timeout [1] help here?

[1] https://www.postgresql.org/docs/devel/runtime-config-client.html

Regards,
Bharath Rupireddy.




Question on cast string to date

2022-05-09 Thread 正华吕
Hi,

I test the following SQL in pg15dev (seems same behavior as the
previous version).

select '2020701'::date;
date
   
0202-07-01
   (1 row)

   At the first glance, the result seems quite strange.

   Go through the code, postgres use date_in to do the cast, and firstly
use last 2 chars to
   get the day, and the 2 chars to get the month, and all remaining chars
as year.

   The question here is: should we throw error for such input? Or what
standard postgres is
   using to cast such kind of string?

Thanks.


Re: Question on cast string to date

2022-05-09 Thread Pavel Stehule
út 10. 5. 2022 v 6:28 odesílatel 正华吕  napsal:

> Hi,
>
> I test the following SQL in pg15dev (seems same behavior as the
> previous version).
>
> select '2020701'::date;
> date
>
> 0202-07-01
>(1 row)
>
>At the first glance, the result seems quite strange.
>
>Go through the code, postgres use date_in to do the cast, and firstly
> use last 2 chars to
>get the day, and the 2 chars to get the month, and all remaining chars
> as year.
>
>The question here is: should we throw error for such input? Or what
> standard postgres is
>using to cast such kind of string?
>

This is ISO format

https://en.wikipedia.org/wiki/ISO_8601

https://postgresqlco.nf/doc/en/param/DateStyle/

Regards

Pavel

>
> Thanks.
>


Re: Question on cast string to date

2022-05-09 Thread Ian Lawrence Barwick
2022年5月10日(火) 13:28 正华吕 :
>
> Hi,
>
> I test the following SQL in pg15dev (seems same behavior as the previous 
> version).
>
> select '2020701'::date;
> date
>
> 0202-07-01
>(1 row)
>
>At the first glance, the result seems quite strange.
>
>Go through the code, postgres use date_in to do the cast, and firstly use 
> last 2 chars to
>get the day, and the 2 chars to get the month, and all remaining chars as 
> year.
>
>The question here is: should we throw error for such input? Or what 
> standard postgres is
>using to cast such kind of string?

This is ISO-8601 format, see here for a list of possible input formats:

  
https://www.postgresql.org/docs/current/datatype-datetime.html#id-1.5.7.13.18.5


Regards

Ian Barwick

-- 
EnterpriseDB: https://www.enterprisedb.com




Re: Question on cast string to date

2022-05-09 Thread Tom Lane
=?UTF-8?B?5q2j5Y2O5ZCV?=  writes:
> I test the following SQL in pg15dev (seems same behavior as the
> previous version).
> select '2020701'::date;
> date
>
> 0202-07-01
>(1 row)
>At the first glance, the result seems quite strange.

[ shrug... ]  You left out a zero.  It's not apparent to me that
this answer is wrong.

>The question here is: should we throw error for such input? Or what
> standard postgres is
>using to cast such kind of string?

The bar to changing any behavior here is a *lot* higher than
you seem to imagine.

Having said that, it does appear that we changed this somewhere
between 9.3 and 9.4:

psql (9.3.25)
Type "help" for help.

regression=# select '2020701'::date;
ERROR:  invalid input syntax for type date: "2020701"
LINE 1: select '2020701'::date;
   ^

psql (9.4.26)
Type "help" for help.

regression=# select '2020701'::date;
date

 0202-07-01
(1 row)

If you want to pursue this question, you could start by bisecting
to find just which commit changed it and why.

regards, tom lane




Re: Question on cast string to date

2022-05-09 Thread David G. Johnston
On Monday, May 9, 2022, Tom Lane  wrote:

> =?UTF-8?B?5q2j5Y2O5ZCV?=  writes:
> > I test the following SQL in pg15dev (seems same behavior as the
> > previous version).
> > select '2020701'::date;
> > date
> >
> > 0202-07-01
> >(1 row)
> >At the first glance, the result seems quite strange.
>
> [ shrug... ]  You left out a zero.  It's not apparent to me that
> this answer is wrong.


> If you want to pursue this question, you could start by bisecting
> to find just which commit changed it and why.
>
>
Manual history inspection of datetime.c

https://github.com/postgres/postgres/commit/7778ddc7a2d5b006edbfa69cdb44b8d8c24ec1ff


https://www.postgresql.org/message-id/flat/8977CB36860C5843884E0A18D8747B0372BC6401%40szxeml558-mbs.china.huawei.com#8aa7c8b8916056a53f6c6dff0f0eb428

The goal seemed to be able to accept 5-digit years…this behavior change
didn’t show in the tests (or discussion) though I didn’t look for the of
testing the pre-existing failure mode.

David J.


Re: Question on cast string to date

2022-05-09 Thread 正华吕
Thanks all.

David G. Johnston  于2022年5月10日周二 13:41写道:

> On Monday, May 9, 2022, Tom Lane  wrote:
>
>> =?UTF-8?B?5q2j5Y2O5ZCV?=  writes:
>> > I test the following SQL in pg15dev (seems same behavior as the
>> > previous version).
>> > select '2020701'::date;
>> > date
>> >
>> > 0202-07-01
>> >(1 row)
>> >At the first glance, the result seems quite strange.
>>
>> [ shrug... ]  You left out a zero.  It's not apparent to me that
>> this answer is wrong.
>
>
>> If you want to pursue this question, you could start by bisecting
>> to find just which commit changed it and why.
>>
>>
> Manual history inspection of datetime.c
>
>
> https://github.com/postgres/postgres/commit/7778ddc7a2d5b006edbfa69cdb44b8d8c24ec1ff
>
>
> https://www.postgresql.org/message-id/flat/8977CB36860C5843884E0A18D8747B0372BC6401%40szxeml558-mbs.china.huawei.com#8aa7c8b8916056a53f6c6dff0f0eb428
>
> The goal seemed to be able to accept 5-digit years…this behavior change
> didn’t show in the tests (or discussion) though I didn’t look for the of
> testing the pre-existing failure mode.
>
> David J.
>
>
>


Re: Question on cast string to date

2022-05-09 Thread Tom Lane
"David G. Johnston"  writes:
> On Monday, May 9, 2022, Tom Lane  wrote:
>> If you want to pursue this question, you could start by bisecting
>> to find just which commit changed it and why.

> Manual history inspection of datetime.c
> https://github.com/postgres/postgres/commit/7778ddc7a2d5b006edbfa69cdb44b8d8c24ec1ff

Ah, yeah, that looks plausible -- the previous code allowed 6 digits
YYMMDD or 8 digits MMDD, the new code allowed >= 6 digits with
2 or more YY followed by MMDD.  So the specific case of YYYMMDD
was rejected before and not after.  Doesn't seem to have been planned,
but it's not so obviously inconsistent that I'd care to break it
again nine years later.  By now, somebody might be depending on it.

regards, tom lane