RE: PostgreSQl, PHP and IIS

2018-09-22 Thread Mark Williams
"Fatal error: Call to undefined function pg_connect".

Obviously, that is to be expected if pgsql module is not loading.

__

-Original Message-
From: Adrian Klaver  
Sent: 21 September 2018 23:02
To: Mark Williams ;
pgsql-general@lists.postgresql.org
Subject: Re: PostgreSQl, PHP and IIS

On 9/21/18 10:35 AM, Mark Williams wrote:
> I have PHP v7.2.7 and PostgreSQL v10 with Windows IIS.
> 
> I am trying to get this to work following any advice I have been able 
> to find on the web, but with no success. My configuration so far is as
below.
> 
> PHP.ini extension list includes both php_pdo_pgsql.dll and php_pgsql.dll.
> 
> Both these dlls are located in the correct extensions directory 
> according to phpinfo.
> 
> According to phpinfo the Configuration File Path is "C:\Windows" and 
> the Loaded Configuration File is "C:\Program Files\PHP\v7.2\php.ini". 
> I have the same php.ini file at both locations.
> 
> I have copied the version of libpq.dll from the lib folder of the 
> postgresql installation to the root folder of the PHP installation.
> 
> I have added the bin folder of the postgresql installation to the 
> Windows system search path.
> 
> Phpinfo shows that pdo_pgsql extension is loaded but not pgsql.
> 
> I have also tried copying the dependent dlls (ssleay32.dll, 
> libeay32.dll, libintl-8.dll, libiconv-2.dll) from the postgresql bin 
> folder to the php root folder).
> 
> Phpinfo show php_pdo_pgsql is enabled, but not php_pgsql.dll and an 
> undefined function call error is displayed by php when I try and run 
> any pg php functions.
> 
> Can anyone please shed any light on what more I need to do?

So what is the error you are getting?

Or to put it another way, what is not happening?

> 
> Regards,
> 
> Mark
> 


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




postgresql systemd service fails to start only on boot but not manually

2018-09-22 Thread Doron Behar
Hello everyone,

I'm having trouble with my PostgreSQL Systemd service and I wonder
whether this is a problem with the software or some problem with the
packaging or build.

My server fails to start PostgreSQL only on boot, if I restart it
manually afterwards it doesn't have any problem starting. Here is the
log extracted from the journal:

```
2018-09-21 20:46:40.028 CEST [306] LOG:  listening on IPv4 address "127.0.0.1", 
port 5432
2018-09-21 20:46:40.036 CEST [306] LOG:  listening on Unix socket 
"/run/postgresql/.s.PGSQL.5432"
2018-09-21 20:46:40.233 CEST [337] LOG:  database system was shut down at 
2018-09-21 20:46:21 CEST
2018-09-21 20:48:10.441 CEST [352] WARNING:  worker took too long to start; 
canceled
2018-09-21 20:49:10.469 CEST [352] WARNING:  worker took too long to start; 
canceled
2018-09-21 20:49:10.478 CEST [306] LOG:  database system is ready to accept 
connections
2018-09-21 20:49:10.486 CEST [306] LOG:  received fast shutdown request
2018-09-21 20:49:10.497 CEST [306] LOG:  aborting any active transactions
2018-09-21 20:49:10.498 CEST [637] FATAL:  terminating autovacuum process due 
to administrator command
2018-09-21 20:49:10.500 CEST [306] LOG:  worker process: logical replication 
launcher (PID 636) exited with code 1
2018-09-21 20:49:10.501 CEST [349] LOG:  shutting down
2018-09-21 20:49:10.518 CEST [306] LOG:  database system is shut down
```

Any Ideas? I'd really like to fix this since now after every reboot I have to
remember to manually restart it.

Thanks.



Re: heads up on large text fields.

2018-09-22 Thread Andreas Kretschmer




Am 22.09.2018 um 02:28 schrieb Rob Sargent:

However, I get into deep dodo when I try redirecting psql output such as

select ld from gt.ld\g /tmp/regen.file



works for me if i start psql with -t -A -o /path/to/file
(pg 10.5, but psql from 11beta3)


Regards, Andreas

--
2ndQuadrant - The PostgreSQL Support Company.
www.2ndQuadrant.com




Re: PostgreSQl, PHP and IIS

2018-09-22 Thread Daniel Verite
Mark Williams wrote:

> Can anyone please shed any light on what more I need to do?

Overall, what you did looks good.
I've never used IIS, but when faced with similar problems with Apache,
ProcessExplorer [1] has been quite effective to figure out which
dependent DDLs were missing, where PHP was searching for them,
and the precise errors it encountered.

[1] https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer

Best regards,
-- 
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite



Re: postgresql systemd service fails to start only on boot but not manually

2018-09-22 Thread Adrian Klaver

On 9/22/18 3:44 AM, Doron Behar wrote:

Hello everyone,

I'm having trouble with my PostgreSQL Systemd service and I wonder
whether this is a problem with the software or some problem with the
packaging or build.

My server fails to start PostgreSQL only on boot, if I restart it
manually afterwards it doesn't have any problem starting. Here is the
log extracted from the journal:

```
2018-09-21 20:46:40.028 CEST [306] LOG:  listening on IPv4 address "127.0.0.1", 
port 5432
2018-09-21 20:46:40.036 CEST [306] LOG:  listening on Unix socket 
"/run/postgresql/.s.PGSQL.5432"
2018-09-21 20:46:40.233 CEST [337] LOG:  database system was shut down at 
2018-09-21 20:46:21 CEST
2018-09-21 20:48:10.441 CEST [352] WARNING:  worker took too long to start; 
canceled
2018-09-21 20:49:10.469 CEST [352] WARNING:  worker took too long to start; 
canceled
2018-09-21 20:49:10.478 CEST [306] LOG:  database system is ready to accept 
connection > 2018-09-21 20:49:10.486 CEST [306] LOG:  received fast shutdown 
request
2018-09-21 20:49:10.497 CEST [306] LOG:  aborting any active transactions
2018-09-21 20:49:10.498 CEST [637] FATAL:  terminating autovacuum process due 
to administrator command
2018-09-21 20:49:10.500 CEST [306] LOG:  worker process: logical replication 
launcher (PID 636) exited with code 1
2018-09-21 20:49:10.501 CEST [349] LOG:  shutting down
2018-09-21 20:49:10.518 CEST [306] LOG:  database system is shut down
```

Any Ideas? I'd really like to fix this since now after every reboot I have to
remember to manually restart it.


Linux distro and version?

Assuming Postgres version 10+ given logical replication warning. Still 
actual version would be nice.


How did you install Postgres?

Where did systemd script come from?

What is in the systemd script?

What does the log show when you do a successful manual start?

What does the system log show when the Postgres reboot startup fails?






Thanks.





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



Re: postgresql systemd service fails to start only on boot but not manually

2018-09-22 Thread Christoph Moench-Tegeder
## Doron Behar (doron.be...@gmail.com):

> My server fails to start PostgreSQL only on boot, if I restart it
> manually afterwards it doesn't have any problem starting. Here is the
> log extracted from the journal:
> 
> ```
> 2018-09-21 20:46:40.028 CEST [306] LOG:  listening on IPv4 address 
> "127.0.0.1", port 5432
> 2018-09-21 20:46:40.036 CEST [306] LOG:  listening on Unix socket 
> "/run/postgresql/.s.PGSQL.5432"
> 2018-09-21 20:46:40.233 CEST [337] LOG:  database system was shut down at 
> 2018-09-21 20:46:21 CEST
> 2018-09-21 20:48:10.441 CEST [352] WARNING:  worker took too long to start; 
> canceled
> 2018-09-21 20:49:10.469 CEST [352] WARNING:  worker took too long to start; 
> canceled

This would indicate that your machine is overloaded during start -
perhaps there's just too much being started at the same time?
ObRant: that's what happens if people take "system startup duration"
as a benchmark and optimize for that - sure, running one clumsy shell
script after another isn't effective usage of today's systems,
but starting eight dozens programs all at once may have other
side effects. Really, with the hardware taking small ages to find
it's own arse before even loading the boot loader, those few seconds
weren't worth optimizing - and if people reboot their computers so
often that startup time takes a measurable toll on their productive
day, perhaps they should rather spend their time thinking about their
usage pattern than "optimizing" the startup process.

So, now that I've got that off my chest... your machine propably tries to
do too much at the same time when booting: the worker processes take
longer than 90 seconds to start. Slow CPU or storage maybe?

> 2018-09-21 20:49:10.478 CEST [306] LOG:  database system is ready to accept 
> connections
> 2018-09-21 20:49:10.486 CEST [306] LOG:  received fast shutdown request

And in the mean time, systemd has lost it's patience, declares the
start as failed and terminates the process group. (The default systemd
timeout is 90 seconds, at least in some releases of systemd, so
this fits quite nicely).

You could try to work around this by increasing TimeoutStartSec
in postgresql's systemd unit (or even globally), which perhaps
only hides the problem until the next service suddenly doesn't
start anymore.
You could move postgresql to the end of the boot order by
adding "After=..." to the Unit section of the systemd service
file, the value behind "After=" being all the other services in
the same target, which should reduce parallelism and improve
PostgreSQL's startup behaviour.
A more advanced variant of that would be to create a new
systemd target, make that start "After" multiuser.target
or even graphical.target (depending on your setup), make sure
it "Requires" the current default systemd target and make
postgresql the only additional service in that target.
(This would be the cleanest solution, but you should get some
grasp of systemd and how your specific distribution uses it
before meddling with the default targets; I don't know every
distribution/version variant of systemd integration, so I
can't give that specific instructions here).
Or you figure out what the heck your machine is running
during startup any why it is that slow, and try to fix that.

Regards,
Christoph

-- 
Spare Space



Re: PostgreSQl, PHP and IIS

2018-09-22 Thread Adrian Klaver

On 9/22/18 3:06 AM, Mark Williams wrote:

"Fatal error: Call to undefined function pg_connect".

Obviously, that is to be expected if pgsql module is not loading.


Went back over your previous post and saw:

"I have copied the version of libpq.dll from the lib folder of the 
postgresql installation to the root folder of the PHP installation.


I have added the bin folder of the postgresql installation to the 
Windows system search path.

"

I would say add the lib/ of the Postgres install to the search path.



__

-Original Message-
From: Adrian Klaver 
Sent: 21 September 2018 23:02
To: Mark Williams ;
pgsql-general@lists.postgresql.org
Subject: Re: PostgreSQl, PHP and IIS

On 9/21/18 10:35 AM, Mark Williams wrote:

I have PHP v7.2.7 and PostgreSQL v10 with Windows IIS.

I am trying to get this to work following any advice I have been able
to find on the web, but with no success. My configuration so far is as

below.


PHP.ini extension list includes both php_pdo_pgsql.dll and php_pgsql.dll.

Both these dlls are located in the correct extensions directory
according to phpinfo.

According to phpinfo the Configuration File Path is "C:\Windows" and
the Loaded Configuration File is "C:\Program Files\PHP\v7.2\php.ini".
I have the same php.ini file at both locations.

I have copied the version of libpq.dll from the lib folder of the
postgresql installation to the root folder of the PHP installation.

I have added the bin folder of the postgresql installation to the
Windows system search path.

Phpinfo shows that pdo_pgsql extension is loaded but not pgsql.

I have also tried copying the dependent dlls (ssleay32.dll,
libeay32.dll, libintl-8.dll, libiconv-2.dll) from the postgresql bin
folder to the php root folder).

Phpinfo show php_pdo_pgsql is enabled, but not php_pgsql.dll and an
undefined function call error is displayed by php when I try and run
any pg php functions.

Can anyone please shed any light on what more I need to do?


So what is the error you are getting?

Or to put it another way, what is not happening?



Regards,

Mark




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





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



Re: Code of Conduct plan

2018-09-22 Thread Robert Haas
On Fri, Sep 14, 2018 at 4:17 PM, Tom Lane  wrote:
> There's been quite a lot of input, from quite a lot of people, dating
> back at least as far as a well-attended session at PGCon 2016.  I find
> it quite upsetting to hear accusations that core is imposing this out
> of nowhere.  From my perspective, we're responding to a real need
> voiced by other people, not so much by us.

Yeah, but there's a difference between input and agreement.  I don't
think there's been a mailing list thread anywhere at any time where a
clear majority of the people on that thread supported the idea of a
code of conduct.  I don't think that question has even been put.  I
don't think there's ever been a developer meeting where by a show of
hands the idea of a CoC, much less the specific text, got a clear
majority.  I don't think that any attempt has been made to do that,
either.  Core is (thankfully) not usually given to imposing new rules
on the community; we normally operate by consensus.  Why this specific
instance is an exception, as it certainly seems to be, is unclear to
me.

To be clear, I'm not saying that no harassment occurs in our
community.  I suspect women get harassed at our conferences.  I know
of only one specific incident that made me uncomfortable, and that was
quite a few years ago and the woman in question laughed it off when I
asked her if there was a problem, but I have heard rumors of other
things on occasion, and I just wouldn't be too surprised if we're not
all as nice in private as we pretend to be in public.  And on the
other hand, I think that mailing list discussions step over the line
to harassment from time to time even though that's in full public
view.  Regrettably, you and I have both been guilty of that from time
to time, as have many others.  I know that I, personally, have been
trying to be a lot more careful about the way I phrase criticism in
recent years; I hope that has been noticeable, but I only see it from
my own perspective, so I don't know.  Nonwithstanding, I would like to
see us, as a group, do better.  We should tolerate less bad behavior
in ourselves and in others, and however good or bad we are today as
people, we should try to be better people.

Whether or not the code of conduct plan that the core committee has
decided to implement is likely to move us in that direction remains
unclear to me.  I can't say I'm very impressed by the way the process
has been carried out up to this point; hopefully it will work out for
the best all the same.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company