Re: How to reply to an existing bug?

2018-05-28 Thread Magnus Hagander
On Mon, May 28, 2018, 02:00 Erwin Brandstetter  wrote:

> I found an existing bug report and have something to add to it.
>
> What's the best way to reply to it? Just using a browser, with no
> newsreader installed.
>
> This one:
>
> https://www.postgresql.org/message-id/flat/20170925084522.1442.32786%40wrigleys.postgresql.org#20170925084522.1442.32...@wrigleys.postgresql.org
>
>

There is no way to do that from the browser alone in the archives. The
easiest you can do is download the thread mbox (one is available for each
thread, so you don't have do download a whole month worth of email) and
open it in your mail program. That should give you an option to reply from
there, and the reply will properly have the references required to enter
the thread properly.

/Magnus


Re: case statement within insert

2018-05-28 Thread Peter J. Holzer
On 2018-05-25 17:04:25 +0800, tango ward wrote:
> 
> 
> I want to insert data from mysql into a table in postgresql. I want to check
> when the subjectcode contains PE or NSTP so I can assign True or False to
> another column in destination DB.
> 
> 
> # Source data:
> 
>  # Source data: MySQL
>    curr_msql.execute(''' SELECT code, subjectname
>   FROM test_subj ''')
> 
> # Destination
> for row in curr_msql:
>     curr_psql.execute(''' INSERT INTO subs (
>     created, modified,
>     subjcode, subjname,
>     is_pe_or_nstp)
> 
>   VALUES (current_timestamp, 
> current_timestamp,
>   %s, %s,
>   CASE
>     WHEN code like '%%PE%%' or code like '%%NSTP%%'
>     THEN True
>     ELSE False
>     END) ''', (row['code'], row['subjectname']))

Others have already explained why that doesn't work and how you can fix
it.

But since you are inserting one row at a time in a Python loop, I don't
see any advantage in writing the condition in SQL. Do it in Python
instead:

for row in curr_msql:
is_pe_or_nstp = 'PE' in row['code'] or 'NSTP' in row['code']
curr_psql.execute(''' INSERT INTO subs (
created, modified,
subjcode, subjname,
is_pe_or_nstp)

  VALUES (current_timestamp, current_timestamp,
  %s, %s,
  %s)
  ''',
  (row['code'], row['subjectname'],
   is_pe_or_nstp,))

A bit more readable, IMHO.

Alternatively, import the complete table *unchanged* from MySQL (you can
use copy_from() for this which is much faster than individual inserts),
and then convert it with a single SQL statement.

hp


-- 
   _  | Peter J. Holzer| we build much bigger, better disasters now
|_|_) || because we have much more sophisticated
| |   | h...@hjp.at | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson 


signature.asc
Description: PGP signature


pgdg-keyring (or apt-key) failure on fresh 9.6 install

2018-05-28 Thread Moreno Andreo

Hi folks,
I'm trying to install Postgresql 9.6 on a test machine in Google Cloud 
Platform
After a fresh install with Debian 9 (just after the instance has been 
created) I follow steps from here


https://wiki.postgresql.org/wiki/Apt

(instead of pg 10 I install pg 9.6)

During the installation process i encounter the following strange 
warnings that, even if that's a test machine, make me think twice before 
going ahead.


[...]
Processing triggers for man-db (2.7.6.1-2) ...
Setting up pgdg-keyring (2017.3) ...
Removing apt.postgresql.org key from trusted.gpg: Warning: The postinst 
maintainerscript of the package pgdg-keyring
Warning: seems to use apt-key (provided by apt) without depending on 
gnupg or gnupg2.
Warning: This will BREAK in the future and should be fixed by the 
package maintainer(s).
Note: Check first if apt-key functionality is needed at all - it 
probably isn't!

OK
Setting up xml-core (0.17) ...
[...]

I have to say that installation is successfully and database server goes 
up and apparently with no problems at all.


Here's versions:

postgres=# select version();

version 
 



PostgreSQL 9.6.9 on x86_64-pc-linux-gnu (Debian 9.6.9-2.pgdg90+1), 
compiled by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, 64-bit(1 row)


Anyone stumped on it? Googling around I see a post saying that's about a 
dirmngr package missing tried but no avail.


Do I need to worry?

Thanks

Moreno.-







Re: ERROR: found multixact from before relminmxid

2018-05-28 Thread Andres Freund
Hi,

I think I found the bug, and am about to post a fix for it belo
https://postgr.es/m/20180525203736.crkbg36muzxrj...@alap3.anarazel.de.

Greetings,

Andres Freund



Re: pgdg-keyring (or apt-key) failure on fresh 9.6 install

2018-05-28 Thread Tim Cross


Moreno Andreo  writes:

> Hi folks,
> I'm trying to install Postgresql 9.6 on a test machine in Google Cloud 
> Platform
> After a fresh install with Debian 9 (just after the instance has been 
> created) I follow steps from here
>
> https://wiki.postgresql.org/wiki/Apt
>
> (instead of pg 10 I install pg 9.6)
>
> During the installation process i encounter the following strange 
> warnings that, even if that's a test machine, make me think twice before 
> going ahead.
>
> [...]
> Processing triggers for man-db (2.7.6.1-2) ...
> Setting up pgdg-keyring (2017.3) ...
> Removing apt.postgresql.org key from trusted.gpg: Warning: The postinst 
> maintainerscript of the package pgdg-keyring
> Warning: seems to use apt-key (provided by apt) without depending on 
> gnupg or gnupg2.
> Warning: This will BREAK in the future and should be fixed by the 
> package maintainer(s).
> Note: Check first if apt-key functionality is needed at all - it 
> probably isn't!
> OK
> Setting up xml-core (0.17) ...
> [...]
>
> I have to say that installation is successfully and database server goes 
> up and apparently with no problems at all.
>

This looks like a warning for the package maintainers regarding ensuring
the package depends on either gnupg or gnupg2 and nothing you need to
worry about unless you are building/maintaining deb packages for postgres.

The Debian package manager, apt, uses gpg keys to verify the
authenticity of packages it downloads. My guess is that previously, you
only needed to ensure the package had a dependency on apt-key and now
apt has/is changing such that you need to have an explicit dependency on
either gnupg or gnupg2. 

-- 
Tim Cross



How to drop a value from an ENUM?

2018-05-28 Thread Torsten Förtsch
Hi,

I am absolutely sure a certain value of one of my ENUM types is not used in
the entire database. Now I am asked to drop that value. Unfortunately,
there is no ALTER TYPE DROP VALUE.

On my development box I tried

delete from pg_enum
 where enumtypid='my_type_name'::regtype
   and enumlabel='my_label'

It worked and I could not find any adverse effects.

Given the value is not used anywhere, is this a save command?

Thanks,
Torsten


binaries for 11 beta compiled with --with-llvm?

2018-05-28 Thread Thomas Kellerer
Are there any plans to provide a binary download for the Postgres 11 beta with 
JITting enabled? 

Currently I can't find any packages under https://www.postgresql.org/download/ 
or http://www.enterprisedb.com/products-services-training/pgbindownload

The only one I found was from BigSQL 
https://www.openscg.com/bigsql/package-manager/

But neither the Linux binaries nor the Windows binaries were compiled with the 
--with-llvm option 
(will JITting be possible with Windows at all?)

Thanks
Thomas




Re: binaries for 11 beta compiled with --with-llvm?

2018-05-28 Thread Andres Freund
Hi,

On 2018-05-29 07:54:52 +0200, Thomas Kellerer wrote:
> But neither the Linux binaries nor the Windows binaries were compiled with 
> the --with-llvm option 
> (will JITting be possible with Windows at all?)

Not in 11.

Greetings,

Andres Freund



Re: binaries for 11 beta compiled with --with-llvm?

2018-05-28 Thread Thomas Kellerer
Andres Freund schrieb am 29.05.2018 um 08:28:
>> But neither the Linux binaries nor the Windows binaries were compiled with 
>> the --with-llvm option 
>> (will JITting be possible with Windows at all?)
> 
> Not in 11.

I assumed that ;) 
Not a real problem.

But what about Linux binaries with JITting enabled? 
I would like to test some of our DWH queries to see if that improves performance

Or do I need to compile Postgres 11 myself to get that? 

Thomas