public inbox for [email protected]  
help / color / mirror / Atom feed
Re: Insert records in the tavke only if they are not exist
2+ messages / 2 participants
[nested] [flat]

* Re: Insert records in the tavke only if they are not exist
@ 2024-12-07 03:55 David G. Johnston <[email protected]>
  2024-12-07 04:02 ` Re: Insert records in the tavke only if they are not exist Igor Korot <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: David G. Johnston @ 2024-12-07 03:55 UTC (permalink / raw)
  To: Igor Korot <[email protected]>; +Cc: pgsql-generallists.postgresql.org <[email protected]>

On Friday, December 6, 2024, Igor Korot <[email protected]> wrote:
>
> When my application starts up, ot creates some tables and insert records
> in them.
>
> When the app starts for the second time it should check if the tables and
> the records in them are exist and skip the process.
>
> Everything is good, except what if I have a connection from 2 different
> users?
>
> I can run this inside transaction, but will this be enough? Will stating
> transaction lock the DB and the second user will wait for transaction to
> complete?
>
>
Seems like letting the create table fail would be a reliable way to
determine what is happening.  But this procedure overall just seems better
avoided.  Can’t you just run an installer/updater separate from running the
application?

David J.


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Insert records in the tavke only if they are not exist
  2024-12-07 03:55 Re: Insert records in the tavke only if they are not exist David G. Johnston <[email protected]>
@ 2024-12-07 04:02 ` Igor Korot <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Igor Korot @ 2024-12-07 04:02 UTC (permalink / raw)
  To: David G. Johnston <[email protected]>; +Cc: pgsql-generallists.postgresql.org <[email protected]>

Hi, Dvid,

On Fri, Dec 6, 2024, 9:55 PM David G. Johnston <[email protected]>
wrote:

> On Friday, December 6, 2024, Igor Korot <[email protected]> wrote:
>>
>> When my application starts up, ot creates some tables and insert records
>> in them.
>>
>> When the app starts for the second time it should check if the tables and
>> the records in them are exist and skip the process.
>>
>> Everything is good, except what if I have a connection from 2 different
>> users?
>>
>> I can run this inside transaction, but will this be enough? Will stating
>> transaction lock the DB and the second user will wait for transaction to
>> complete?
>>
>>
> Seems like letting the create table fail would be a reliable way to
> determine what is happening.  But this procedure overall just seems better
> avoided.  Can’t you just run an installer/updater separate from running the
> application?
>

Interesting idea bout the installer.
Except those tables will contain some additional info about the schema and
the application.

So if I create/remove new table, either in my app or from psql the record
will need to be inserted/deleted.

Thank you.


> David J.
>
>


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2024-12-07 04:02 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-12-07 03:55 Re: Insert records in the tavke only if they are not exist David G. Johnston <[email protected]>
2024-12-07 04:02 ` Igor Korot <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox