Re: [GENERAL] import .sql file into PostgreSQL database

2020-05-09 Thread Michael Paquier
On Thu, May 07, 2020 at 11:46:02PM -0400, Gaurav wrote:
> Just going thru old emails and came across this one. Thought to text you.
> How have you been? What are you up to? How can I rejoin this group?

Fine thanks.  In order to subscribe to one or more mailing lists,
please feel free to look here:
https://lists.postgresql.org/
--
Michael


signature.asc
Description: PGP signature


Re: pg_basebackup cannot compress to STDOUNT

2020-05-09 Thread Support

On 5/8/2020 11:51 PM, Paul Förster wrote:


Hi Admin,


On 08. May, 2020, at 21:31, Support  wrote:
2) Command run?
ssh postgres@nodeXXX "pg_basebackup -h /run/postgresql -Ft -D- | pigz -c -p2 " 
| pigz -cd -p2 | tar -xf- -C /usr/local/pgsql/data

I don't get it, sorry. Do I understand you correctly here that you want an 
online backup or a *remotely* running PostgreSQL instance on your local machine?

If so, why not just let pg_basebackup connect remotely and let it do its magic? 
Something like this:

$ mkdir -p /usr/local/pgsql/data
$ cd /usr/local/pgsql/data
$ pg_basebackup -D /run/postgresql -Fp -P -v -h nodeXXX -p 5432 -U replicator
$ pg_ctl start

You'd have to have a role with replication privs or superuser and you'd have to 
adapt the port of course.

No need to take care of any WALs manually. It is all taken care of by 
pg_basebackup. The only real drawback is that if you have tablespaces, you'd 
have to create all directories of the tablespaces beforehand, which is why we 
removed them again after initially having tried the feature.

That's basically, how I create async replicas on out site, which is why I 
additionally add -R to the above command.

Cheers,
Paul

The trick of my command above is to get the transfer faster in one 
compressed file going through the network.





Re: Best way to use trigger to email a report ?

2020-05-09 Thread Tim Clarke
Personally I'd have your trigger put the necessary data into a queue to run the 
report then have some other process take that data off asynchronously. Either 
pop it in a table and do it yourself or use a robust distributed broker 
protocol platform like RabbitMQ or Apache ActiveMQ  or Kafka.

Tim Clarke MBCS
IT Director
Direct: +44 (0)1376 504510 | Mobile: +44 (0)7887 563420

On 08/05/2020 17:26, David Gauthier wrote:
psql (9.6.0, server 11.3) on linux

Looking for ideas.  I want a trigger to...
1) compose an html report based on DB content
2) email the report to a dist list (dl = value of a table column)

If this will involve hybrid coding, I prefer PL/perl.  The linux env has both 
"mail" and "mutt" (if this is of any help).

The idea is to send a report to the list when all the data has been collected 
for a particular job and the final status of the job is updated as a col of a 
rec of a certain table.  Probably a post update trigger.

Thanks for any ideas :-)






Telephone: Witham: +44(0)1376 503500 | London: +44 (0)20 3009 0853 | Frankfurt: 
+49 (0)69 7191 6000 | Hong Kong: +852 5803 1687 | Toronto: +1 647 503 2848
Web: https://www.manifest.co.uk/



Minerva Analytics Ltd - A Solactive Company
9 Freebournes Court | Newland Street | Witham | Essex | CM8 2BL | United Kingdom



Copyright: This e-mail may contain confidential or legally privileged 
information. If you are not the named addressee you must not use or disclose 
such information, instead please report it to 
ad...@minerva.info
Legal: Minerva Analytics is the trading name of: Minerva Analytics Ltd: 
Registered in England Number 11260966 & The Manifest Voting Agency Ltd: 
Registered in England Number 2920820 Registered Office at above address. Please 
Click Here https://www.manifest.co.uk/legal/ for further information.


Re: Best way to use trigger to email a report ?

2020-05-09 Thread AC Gomez
We're posting a flag to a table. The table has an "event" field. When we
post the value "email" into that field, a sweeper app that runs on a
schedule looks for this flag, then takes the value in the message field and
sends that out as an email.



On Sat, May 9, 2020, 12:31 PM Tim Clarke  wrote:

> Personally I'd have your trigger put the necessary data into a queue to
> run the report then have some other process take that data off
> asynchronously. Either pop it in a table and do it yourself or use a robust
> distributed broker protocol platform like RabbitMQ or Apache ActiveMQ  or
> Kafka.
> Tim Clarke MBCS
> IT Director
> Direct: +44 (0)1376 504510 | Mobile: +44 (0)7887 563420
>
> On 08/05/2020 17:26, David Gauthier wrote:
>
> psql (9.6.0, server 11.3) on linux
>
> Looking for ideas.  I want a trigger to...
> 1) compose an html report based on DB content
> 2) email the report to a dist list (dl = value of a table column)
>
> If this will involve hybrid coding, I prefer PL/perl.  The linux env has
> both "mail" and "mutt" (if this is of any help).
>
> The idea is to send a report to the list when all the data has been
> collected for a particular job and the final status of the job is updated
> as a col of a rec of a certain table.  Probably a post update trigger.
>
> Thanks for any ideas :-)
>
>
>
>
>
> Telephone: Witham: +44(0)1376 503500 | London: +44 (0)20 3009 0853 |
> Frankfurt: +49 (0)69 7191 6000 | Hong Kong: +852 5803 1687 | Toronto: +1
> 647 503 2848
> Web: https://www.manifest.co.uk/
>
>
>
> Minerva Analytics Ltd - A Solactive Company
> 9 Freebournes Court | Newland Street | Witham | Essex | CM8 2BL | United
> Kingdom
>
> --
>
> Copyright: This e-mail may contain confidential or legally privileged
> information. If you are not the named addressee you must not use or
> disclose such information, instead please report it to ad...@minerva.info
> Legal: Minerva Analytics is the trading name of: Minerva Analytics Ltd:
> Registered in England Number 11260966 & The Manifest Voting Agency Ltd:
> Registered in England Number 2920820 Registered Office at above address.
> Please Click Here https://www.manifest.co.uk/legal/ for further
> information.
>