Re: [GENERAL] postmaster deadlock while logging after syslogger exited

2017-11-16 Thread David Pacheco
On Mon, Nov 6, 2017 at 12:35 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: > David Pacheco <d...@joyent.com> writes: > > I ran into what appears to be a deadlock in the logging subsystem. It > > looks like what happened was that the syslogger process exited becau

Re: [GENERAL] Migrating money column from MS SQL Server to Postgres

2017-11-08 Thread David G. Johnston
decide that 0.0 is "double precision" (which is a weird > name in my opinion -- why can't it just be double) and not money? > The lack of quotes surrounding the value is significant. Money input requires a string literal. Only (more or less) integer and double literal values can be written without the single quotes. David J.

Re: [GENERAL] Naming conventions for column names

2017-11-07 Thread David G. Johnston
at it would take zero effort to accomplish. If there is an addition to the system catalogs overview page of the docs that describes the naming convention I think that would be swell. David J.

Re: [GENERAL] postmaster deadlock while logging after syslogger exited

2017-11-06 Thread David Pacheco
On Mon, Nov 6, 2017 at 12:35 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: > David Pacheco <d...@joyent.com> writes: > > ... that process appears to have exited due to a fatal error > > (out of memory). (I know it exited because the process still exists in > the >

Re: [GENERAL] idle in transaction, why

2017-11-06 Thread David G. Johnston
t; to see what a clean session has for a value and then figure out from there where that value is coming from. David J.

[GENERAL] postmaster deadlock while logging after syslogger exited

2017-11-06 Thread David Pacheco
Hello, I ran into what appears to be a deadlock in the logging subsystem. It looks like what happened was that the syslogger process exited because it ran out of memory. But before the postmaster got a chance to handle the SIGCLD to restart it, it handled a SIGUSR1 to start an autovacuum

Re: [GENERAL] ERROR: invalid input syntax for integer: "INSERT"

2017-11-04 Thread David G. Johnston
ECT statement_timestamp(), 'INSERT', ... > > The second column of listings_cdc has a type of integer. The word INSERT is not a valid value to store there. David J.

Re: [GENERAL] explain analyze output: 0 rows, 1M loops

2017-11-01 Thread David G. Johnston
On Wed, Nov 1, 2017 at 12:25 PM, Justin Pryzby <pry...@telsasoft.com> wrote: > On Wed, Nov 01, 2017 at 12:19:21PM -0700, David G. Johnston wrote: > > On Wed, Nov 1, 2017 at 11:59 AM, Scott Marlowe <scott.marl...@gmail.com> > > wrote: > > > > > So some of

Re: [GENERAL] explain analyze output: 0 rows, 1M loopa

2017-11-01 Thread David G. Johnston
=6 width=137) (actual > time=0.110..0.111 rows=0 loops=1,010,844) > ​Not my strong suit but, I'm pretty sure that reads: "The index was queried 1M+ times and none of those inqueries resulted in a record being found". IIUC I'd be wondering why some form of hash join wasn't used... David J.​

Re: [GENERAL] pgaduit - is there a way to audit a role

2017-10-31 Thread David Steele
e db as rakesh who is part of db_rw role. This will not work because settings (GUCs) on a role are not inherited by roles (or users) that are members of that role. This is a characteristic of the roles system and not inherent to pgAudit. -- -David da...@pgmasters.net -- Sent via pgsql-ge

[GENERAL] From the "SQL is verbose" department, WINDOW RANGE specifications

2017-10-30 Thread David G. Johnston
-a-via both the from_item and grouping_element specifications). David J.

[GENERAL] Make "(composite).function_name" syntax work without search_path changes?

2017-10-30 Thread David G. Johnston
ying to write queries that don't require application schemas in the search path: including the joyous operator(altschema.@@) syntax in some situations. I suppose inference could be considered in that situation as well. David J.

Re: [GENERAL] Roles inherited from a role which is the owner of a database can drop it?

2017-10-30 Thread David G. Johnston
etail behind that fragment that is needed if one is going to develop a data access and change management policy. David J.

Re: [GENERAL] starting PG command line options vs postgresql.con

2017-10-30 Thread David G. Johnston
would expect that the configuration file would be changed in lieu of passing options via the command line. Also if conflicting, which one > takes priority. > ​https://www.postgresql.org/docs/9.6/static/config-setting.html#AEN32498​ David J.

Re: [GENERAL] Old pg_clog files

2017-10-29 Thread David G. Johnston
Pd databases should remove old pg_clog files. > > > However, while about 40 of them have been deleted, 183 still exist. What > did I do wrong? > > Reading the old thread it sounds like it might require multiple vacuums to affect complete removal. David J.

Re: [GENERAL] How do I insert and update into a table of arrays of composite types via a select command?

2017-10-25 Thread David G. Johnston
gt; that I tried and failed with... > > ​The ​unusual set of parentheses are so the parser interprets data_comp is a column and not a table. Usually one write SELECT tbl.* FROM tbl so that is the assumed meaning of "name".* David J.

Re: [GENERAL] multiple sql results to shell

2017-10-23 Thread David G. Johnston
raw record data to bash and then use bash's loop facilities to dynamically generate and execute the curl command. A second option, that I've never tried, is returning the full string but not within a backtick command, then using bash looping simply invoke the string like a normal command. David J.

Re: [GENERAL] How to find out extension directory

2017-10-20 Thread David G. Johnston
ent is > > /usr/share/postgresql/10/extension. > > How do I know beforehand where the dir path is ? > I think pg_config ( https://www.postgresql.org/docs/current/static/app-pgconfig.html ) is what you are looking for. David J.

Re: [GENERAL] Is it OK to create a directory in PGDATA dir

2017-10-19 Thread David G. Johnston
On Thu, Oct 19, 2017 at 5:32 PM, John R Pierce wrote: > On 10/19/2017 1:25 PM, Tomas Vondra wrote: > > Is it fine to create a subdir inside PGDATA and store our stuff > there, or will PG freak out seeing a foreign object. > > > PostgreSQL certainly does not check if there

Re: [GENERAL] Using Variables in Queries

2017-10-19 Thread David G. Johnston
esume pure style differences between using multiple from items and an explicit cross join. David J.

Re: [GENERAL] Using Variables in Queries

2017-10-19 Thread David G. Johnston
content with using psql. Adding lots of new custom syntax to pure server-side parsed SQL is a non-trivial undertaking whose need is reduced by the alternatives so described (functions, DO block, PREPARE, psql). David J.

[GENERAL] COPY log row count feauture request

2017-10-19 Thread david . turon
Hi everyone, i have question if is possible log count row of COPY command to csv/syslog. I know that there are some limitations like triggers BEFORE INSERT. Don't know if any others were pleased with this feature. Have a nice day. David -- - Ing. David

Re: [GENERAL] Finally upgrading to 9.6!

2017-10-18 Thread David G. Johnston
wants to espouse the business benefits of running pre-release versions in staging environments against stable business code please start a new thread focused on the "process" and not the "people". David J.

Re: [GENERAL] Finally upgrading to 9.6!

2017-10-18 Thread David G. Johnston
d release gets de-supported. The closer to the first position you are contributing back to the community and also the more quickly you can benefit from the new features and enhancements each new release brings. David J.

Re: [GENERAL] Finally upgrading to 9.6!

2017-10-18 Thread David G. Johnston
em at scales and using workloads that were not known or available to the developers. Its a balancing act for most and falling on the side of waiting for a few point releases before promoting to production is, I suspect, common. David J.

Re: [GENERAL] Problems with the time in data type timestamp without time zone

2017-10-18 Thread David G. Johnston
ead 3 hours, the type of data that has that field > is timestamp without time zone, > > Please forgive my english I'm using translator. > ​A minimal SQL example of your problem would help. David J.​

Re: [GENERAL] Simple query fail

2017-10-17 Thread David G. Johnston
​The "max(ts)" result indicates a time of midnight, the 6th, GMT ts > '2017-10-06 00:01:01+01' equates to > '2017-10-05 23:01:01+00' of which midnight, the 6th, GMT is indeed more recent ts > '2017-10-06 00:01:01+00' is 12:01:01 on the 6th, GMT, of which midnight GMC, the 6th is NOT more recent David J.

Re: [GENERAL] Using Substitution Variables In PostgreSQL

2017-10-16 Thread David G. Johnston
ame' varname SELECT ... WHERE = :'varname'; https://www.postgresql.org/docs/10/static/app-psql.html David J.

Re: [GENERAL] REASSIGN OWNED simply doesn't work

2017-10-13 Thread David G. Johnston
d "privileges" there seems odd too, wouldn't "membership" be more appropriate? https://www.postgresql.org/docs/10/static/sql-reassign-owned.html David J.

Re: [GENERAL] Permissions for Web App

2017-10-13 Thread David G. Johnston
ange default privileges only for objects that will be created by yourself or by roles that you are a member of." You use the "FOR " modifier if you want the "or by roles that you are a member of" portion to be used. David J.

Re: [GENERAL] "Shared strings"-style table

2017-10-13 Thread David G. Johnston
s" like this, reducing size on disk > > > at the cost of lookup overhead for all queries? > > > (I guess maybe it's like TOAST, but content-hashed and de-duped and not > > > only for large objects?) > > On Fri, Oct 13, 2017, at 01:12 PM, David G. Johnston wrote: > &g

Re: [GENERAL] "Shared strings"-style table

2017-10-13 Thread David G. Johnston
? > > (I guess maybe it's like TOAST, but content-hashed and de-duped and not > only for large objects?) > Row-independence is baked into PostgreSQL pretty deeply... I think an enum type is about as close are you are likely to get if you don't wish to setup your own foreign-key relationships with surrogate keys. David J.

Re: [GENERAL] Equivalence Classes when using IN

2017-10-11 Thread David Rowley
uery (or view) up a level. When the planner is able to do this it's much more flexible to the types of plans it can generate. It's just that we don't ever pull up subqueries with DISTINCT ON, plus a bunch of other reasons. -- David Rowley http://www.2ndQuadrant.com/

Re: [GENERAL] Equivalence Classes when using IN

2017-10-11 Thread David Rowley
gs If you > allow the WHERE to pass through ORDER BY. > > A special case can be allowed for WHERE to pass the ORDER BY if the column is > part of DISTINCT ON. Yeah, we do allow predicates to be pushed down in that case. -- David Rowley http://www.2ndQuadrant.com/

Re: [GENERAL] [asking about how to upgrade docker postgresql without losing the data]

2017-10-10 Thread David G. Johnston
he same manner as it is linked into the existing one. If the data is directly within the runtime container it will be considerably more difficult - though pg_dump/pg_restore might prove easiest to accomplish. David J. ​

Re: [GENERAL] Equivalence Classes when using IN

2017-10-09 Thread David Rowley
On 10 October 2017 at 12:44, Tom Lane <t...@sss.pgh.pa.us> wrote: > David Rowley <david.row...@2ndquadrant.com> writes: >> If the only reason that is_simple_subquery() rejects subqueries with >> ORDER BY is due to wanting to keep the order by of a view, then >> co

Re: [GENERAL] Equivalence Classes when using IN

2017-10-09 Thread David Rowley
On 10 October 2017 at 02:51, Tom Lane <t...@sss.pgh.pa.us> wrote: > David Rowley <david.row...@2ndquadrant.com> writes: >> It's pretty bad practice to have ORDER BY in views. I kinda wish we >> didn't even allow it, but that ship sailed many years ago... > >

Re: [GENERAL] Permissions for Web App

2017-10-09 Thread David G. Johnston
privileges.html David J. ​

Re: [GENERAL] pg_start/stop_backup naming conventions

2017-10-09 Thread David G. Johnston
nters. > ​I'll give out the standard advice - don't roll-your-own backup solution - investigate and choose one the many supported and maintained backup solutions (most are open source) that are already available. This kind of detail, then, should become unimportant to you. David J.

Re: [GENERAL] Equivalence Classes when using IN

2017-10-09 Thread David Rowley
mer_id) to parameterise the nested loop, at least, it likely would, if you have one. It's pretty bad practice to have ORDER BY in views. I kinda wish we didn't even allow it, but that ship sailed many years ago... -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Deve

Re: [GENERAL] OR-clause support for indexes

2017-10-09 Thread David Rowley
is being worked on? Any progress in btree-support? Not exactly what you're asking, but perhaps https://commitfest.postgresql.org/14/1001/ could improve your workload, or perhaps you could just manually rewrite the query. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL De

Re: [GENERAL] Equivalence Classes when using IN

2017-10-08 Thread David Rowley
es. [1] https://www.postgresql.org/message-id/flat/CAKJS1f9FK_X_5HKcPcSeimy16Owe3EmPmmGsGWLcKkj_rW9s6A%40mail.gmail.com#cakjs1f9fk_x_5hkcpcseimy16owe3empmmgsgwlckkj_rw9...@mail.gmail.com -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Trai

Re: [GENERAL] a JOIN to a VIEW seems slow

2017-10-07 Thread David Rowley
ow_id GROUP BY c.due_row_id ) c ON c.due_row_id = a.row_id; SQL Server will probably be doing this rewrite. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-general mailing list (pgsql-general@pos

Re: [GENERAL] Functions and Parentheses

2017-10-06 Thread David G. Johnston
e standard forces us to do otherwise function invocation requires parentheses. See 9.9.4 ( https://www.postgresql.org/docs/9.6/static/functions-datetime.html ) David J.

Re: [GENERAL] Setting search_path ignored

2017-10-02 Thread David G. Johnston
On Mon, Oct 2, 2017 at 7:09 AM, Guyren Howe <guy...@gmail.com> wrote: > I logged out and back and did SET ROLE and got the same resullt. > ​ Are you logging in as "thing_accessor" or some role that is a member of "thing_accessor"? David J. ​

Re: [GENERAL] Setting search_path ignored

2017-10-02 Thread David G. Johnston
setting the > schema search path. > ​Settings associated with roles only take affect at session start/login. SET ROLE does not cause them to be read/executed. https://www.postgresql.org/docs/9.6/static/config-setting.html "Values set with ALTER DATABASE and ALTER ROLE are applied only when starting a fresh database session." David J. ​

Re: [GENERAL] Plan changes from index scan to seq scan after 5 executions

2017-09-30 Thread David G. Johnston
On Sat, Sep 30, 2017 at 10:57 AM, Alexander Kukushkin <cyberd...@gmail.com> wrote: > Hi, > > Recently I've been investigating a strange behavior of one stored > procedure. > Please provide the output of: SELECT version(); David J. ​

Re: [GENERAL] COPY vs \COPY FROM PROGRAM $$ quoting difference?

2017-09-29 Thread David G. Johnston
the local program being referred to. The server sees "FROM stdin" and psql feeds the results of the PROGRAM invocation to the server over that pipe. David J.

Re: [GENERAL] Catching errors inside a LOOP is causing performance issues

2017-09-28 Thread David G. Johnston
he pl/pgsql execution layer to trap "arbitrary SQL-layer exceptions"​ is fairly expensive. Even if the user specifies specific errors the error handling mechanism in pl/pgsql is code for generic (arbitrary) errors being given to it. David J.

Re: [GENERAL] pg_upgrade?: Upgrade method from/to any version on random OS?

2017-09-27 Thread David G. Johnston
tes - where we had downtime - not so > good. > ​There is a correlation between the decreased downtime that pg_upgrade facilitates and its complexity.​ If you cannot afford the 2 hours of downtime for dump/restore then likely learning the pg_upgrade process would be the better choice for you. David J.

Re: [GENERAL] Catching errors inside a LOOP is causing performance issues

2017-09-27 Thread David G. Johnston
"plan caching" has anything to do with this; I suspect its basically that there is high memory and runtime overhead to deal with the possibilities of needing to convert a exception into a branch instead of allowing it to be fatal. David J.

Re: [GENERAL] hard parse?

2017-09-21 Thread David G. Johnston
point. With a "always false" predicate and that simple of a query structure most of the other stuff, including execution, is probably performed is seemingly zero time but it still has to work through that step of the process - if nothing else than to move through an if-branch to decide that nothing material needs to be done. David J. ​

Re: [GENERAL] Insert large number of records

2017-09-20 Thread David G. Johnston
her. Insert into ... select from ... is your only option for table-to-table and you are stuck with whatever locks the execution of the command needs to take. David J.

Re: [GENERAL] VM-Ware Backup of VM safe?

2017-09-20 Thread David Steele
en it is almost certainly not safe. Even if it says it is there are potential gotchas. For example, the backup may not be consistent if you are using multiple volumes. In addition, data loss on restore will be greater if there is no WAL archive to play forward from. -- -David da...@pgmasters.net

Re: [GENERAL] reload postgresql with invalid pg_hba.conf

2017-09-18 Thread David G. Johnston
maybe an additional sentence wouldn't hurt...? The docs on configuring the server to speak to this overall flow and what happens when invalid values are encountered (i.e., they are ignored) https://www.postgresql.org/docs/current/static/config-setting.html#CONFIG-INCLUDES David J. diff --git

Re: [GENERAL] Selecting a daily puzzle record - which type of column to add?

2017-09-17 Thread David G. Johnston
he already published puzzles... > > ​Serial (i.e. integer/bigint with an sequence generator). I would then add another table that simply stores the "last manually reviewed id" as its only record (or you could record manual reviews and take the max of that field from the table). David J.

Re: [GENERAL] Remove useless joins (VARCHAR vs TEXT)

2017-09-16 Thread David Rowley
is being a bug. The attached fixes. (CC'd -hackers since we're starting to discuss code changes. Further discussion which includes -hackers should drop the general list) -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Servic

Re: [GENERAL] looking for a globally unique row ID

2017-09-14 Thread David G. Johnston
e. You could setup an FK as well but it wouldn't provide the needed guarantee. Nothing will stop an administrator, or a user with incorrectly configured permissions, from bypassing all of that but properly configured application roles will be unable to do so. David J.

Re: [GENERAL] Numeric numbers

2017-09-02 Thread David G. Johnston
n the screen is not what is physically stored. The documentation about the numeric type on the server is accurate, but apparently the psql application takes some liberties as to what it chooses to display. It's display rules for numeric don't seem to be user documented or configurable. David J,

Re: [GENERAL] Fields re-ordered on JOIN with * and USING

2017-09-01 Thread David G. Johnston
Thanks. > ​I don't recall if or where it is documented but it is intentional., as is the documented fact that only one instance of the named column appears in the output. David J.

Re: [GENERAL] pgadmin - import a CSV with nulls?

2017-08-31 Thread David G. Johnston
On Thu, Aug 31, 2017 at 1:04 PM, George Neuner <gneun...@comcast.net> wrote: > Does anyone know a way to do this reliably? > ​The psql "\copy" meta-command should be capable of doing what you desire. David J.​

Re: [GENERAL] Table create time

2017-08-31 Thread David G. Johnston
uests for this feature have not resulted in patches. David J.

Re: [GENERAL] Create Action for psql when NOTIFY Recieved

2017-08-28 Thread David G. Johnston
your rough description I'm not seeing why you wouldn't just have the trigger write a record out to some kind of journal table and poll that table for new records whenever you wish instead of depending upon LISTEN/NOTIFY. David J.

Re: [GENERAL] Create Action for psql when NOTIFY Recieved

2017-08-28 Thread David G. Johnston
ntent of the notification payload to it via stdin. Given what we allow for "\copy" I don't see any technical or conceptual problems with such a feature. Just needs someone to be its primary author. David J.

Re: [GENERAL] DROP [TEMP] TABLE syntax, as reason why not?

2017-08-24 Thread David G. Johnston
On Wed, Aug 23, 2017 at 6:08 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: > "David G. Johnston" <david.g.johns...@gmail.com> writes: > > I'm wondering if there is anything technical preventing someone from > making: > > > DROP TEMP TABLE tablename; > >

Re: [GENERAL] 'value too long' and before insert/update trigger

2017-08-23 Thread David G. Johnston
that a trigger could be used to make invalid data, for a given type, valid. Some hackish use of views, and triggers thereon, may provide an avenue to gradual migration. David J.

Re: [GENERAL] jdbc driver vis Release 10

2017-08-23 Thread David G. Johnston
out external projects.​ Its seems quite a few significant changes (including version numbering) have happened to the JDBC project in the past year but you will need to go directly to the project's site/GitHub to keep abreast of all of it. David J.

[GENERAL] DROP [TEMP] TABLE syntax, as reason why not?

2017-08-23 Thread David G. Johnston
is not schema-qualified and a table with the same names exists in the search path it would be dropped. Plus its symmetrical with CREATE [TEMP] TABLE. David J.

Re: [GENERAL] Function not inserting rows

2017-08-23 Thread David G. Johnston
placeholder values supplied to a prepared statement are treated as literals. You may also want turn on statement logging in the server. David J.

Re: [GENERAL] What is the proper query

2017-08-22 Thread David G. Johnston
howed, use pg_catalog. I'm not fluent enough to provide examples. If you provide the question/problem you are trying to resolve others will likely offer suggestions. David J.

Re: [GENERAL] What is the proper query

2017-08-22 Thread David G. Johnston
sql.org/message-id/56D0C4B8.7020200%40aklaver.com David J.

Re: [GENERAL] Count column with name 'count' returns multiple rows. Why?

2017-08-18 Thread David G. Johnston
ks mainly in terms of "composite types". A table IS a composite type (i.e., there is an implicit one of the same name) for these purposes.​ David J.

Re: [GENERAL] Where is pg_hba.conf

2017-08-13 Thread David G. Johnston
ostgresql.org/docs/current/static/auth-pg-hba-conf.html David J.

Re: [GENERAL] sequence used on null value or get the max value for a column whith concurrency

2017-08-10 Thread David G. Johnston
nch and re-create the record before returning the just queried maximum + 1. David J.

Re: [GENERAL] How to ALTER EXTENSION name OWNER TO new_owner ?

2017-08-09 Thread David G. Johnston
gt; *I would also argue that since* *"OWNER TO new_owner" is available in all > other ALTER object statements, it is an omission and should be* > *included for extenstions as well..* > ​As am I, but omission or not I don't recall that we've ever back-patched new SQL grammar. David J. ​

Re: [GENERAL] How to ALTER EXTENSION name OWNER TO new_owner ?

2017-08-09 Thread David G. Johnston
On Wed, Aug 9, 2017 at 11:30 AM, Melvin Davidson <melvin6...@gmail.com> wrote: > > > On Wed, Aug 9, 2017 at 1:56 PM, David G. Johnston < > david.g.johns...@gmail.com> wrote: > >> On Wed, Aug 9, 2017 at 10:37 AM, Tom Lane <t...@sss.pgh.pa.us> wrote: >&g

Re: [GENERAL] How to ALTER EXTENSION name OWNER TO new_owner ?

2017-08-09 Thread David G. Johnston
checks, as well as the owner of any objects created by the extension's script. 2>You must own the extension to use ALTER EXTENSION. The ADD/DROP forms require ownership of the added/dropped object as well. 3>CREATE EXTENSION additionally records the identities of all the created objects, so that they can be dropped again if DROP EXTENSION is issued. David J.

Re: [GENERAL] Any thoughts on making a psql meta-command "hide (or show alt text) if no results"?

2017-08-08 Thread David G. Johnston
​ So, close but not quite. I eventually saw, in one of the three descriptions for "tuples only" where the caption is explicitly noted as being hidden in this mode. In my proposed feature the caption, like the table it is attached to, would be visible only conditionally. David J.

[GENERAL] Any thoughts on making a psql meta-command "hide (or show alt text) if no results"?

2017-08-08 Thread David G. Johnston
are descriptive, not suggestions... David J.

[GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)

2017-08-06 Thread David G. Johnston
are not at this point worthwhile. > If it is PostgreSQL's problem you should be able to setup statement logging on the server and see what is happening at the SQL level. David J.

Re: [GENERAL] select md5 result set

2017-08-02 Thread David G. Johnston
On Wed, Aug 2, 2017 at 4:50 PM, Peter Koukoulis <pkoukou...@gmail.com> wrote: > david, thanks for the help. > > Would this be the equivalent, for the statement in your email, for table > TEST1 (x integer, y varchar(20)): > > ft_node=# SELECT md5(string_agg(vals::tex

Re: [GENERAL] select md5 result set

2017-08-02 Thread David G. Johnston
ual; > > MD5_VALUE > > > 9FDA7FA725B783172CA371DA04AD5754 > > > Can I do something similar in PostgreSQL ? > > ​Similar.​ SELECT md5(string_agg(vals::text, '')) FROM ( VALUES (1, 2), (2, 3) ) vals (x, y) ​David J.

Re: [GENERAL] Would you add a --dry-run to pg_restore?

2017-08-02 Thread David G. Johnston
On Wed, Aug 2, 2017 at 10:10 AM, Edmundo Robles <edmu...@sw-argos.com> wrote: > I imagine pg_restore can execute the instructions on dump but don't > write on disk. just like David said: "tell me what is going to happen > but don't actually do it" > You may w

Re: [GENERAL] Do not INSERT if UPDATE fails

2017-08-02 Thread David G. Johnston
ERT. > > ​You can "join" two DDL commands by using a Common Table Expression (CTE) (i.e., WITH / SELECT)​. You would need to make it so the UPDATE happens first and if there are no results the INSERT simply becomes a no-op. David J.

Re: [GENERAL] Would you add a --dry-run to pg_restore?

2017-08-02 Thread David G. Johnston
get larger/more disks. Personally, I'd probably setup a dedicated "test restore" cluster with lots of HD and put stuff like "fsync=off" into its postgresql.conf. I could see having a "--make-tables-unlogged" option that would convert, on-the-fly, all CREATE TABLE commands to "CREATE UNLOGGED TABLE" commands. David J.

Re: [GENERAL] RETURNS SETOF RECORD with 1 column

2017-07-28 Thread David G. Johnston
On Thursday, July 27, 2017, David G. Johnston <david.g.johns...@gmail.com> wrote: > On Thursday, July 27, 2017, Vincenzo Romano <vincenzo.rom...@notorand.it > <javascript:_e(%7B%7D,'cvml','vincenzo.rom...@notorand.it');>> wrote: >> >> The main difference is th

Re: [GENERAL] RETURNS SETOF RECORD with 1 column

2017-07-28 Thread David G. Johnston
. And a consistent one. > But I still don't get the point for not having it for a single column. > > Docs say: " When there are OUT or INOUT parameters, the RETURNS clause can be omitted. ". Sounds like you should you do just that. David J.

Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions

2017-07-24 Thread David G. Johnston
e themselves unique. For me, I'm seeing that the expected number of input rows doesn't factor into the innerbucketsize computation directly (possibly excepting a scaling factor adjustment). I can understand better, now, why this seemingly perfect example of a semi-join query gets executed with an extra distinct/grouping node. David J.

Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions

2017-07-24 Thread David G. Johnston
On Mon, Jul 24, 2017 at 7:58 PM, David G. Johnston < david.g.johns...@gmail.com> wrote: > On Mon, Jul 24, 2017 at 3:46 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: > >> >> The cost to form the inner hash is basically negligible whether it's >> de-duped or n

Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions

2017-07-24 Thread David G. Johnston
s this in more detail would be welcome. Not sure what to grep for - "Hash Semi Join" only turns up a couple of expected output results... Thx. David J.

Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions

2017-07-24 Thread David G. Johnston
n-null which is what I believe is required for the semi-join algorithm to be considered.​ David J.

Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions

2017-07-24 Thread David G. Johnston
ritten as: SELECT * FROM tbl WHERE EXISTS (SELECT 1 FROM tbl2 WHERE tbl.id = tbl2.id) The main difference between IN and EXISTS is NULL semantics. David J.

Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions

2017-07-24 Thread David G. Johnston
meaningful and so the convenience of writing (IN (...)) is worth taking. David J.

Re: [GENERAL] What is the problem with this query?

2017-07-23 Thread David G. Johnston
On Sunday, July 23, 2017, Igor Korot <ikoro...@gmail.com> wrote: > Hi, David, > > On Sun, Jul 23, 2017 at 5:07 PM, David G. Johnston > <david.g.johns...@gmail.com <javascript:;>> wrote: > > On Sunday, July 23, 2017, Igor Korot <iko

Re: [GENERAL] What is the problem with this query?

2017-07-23 Thread David G. Johnston
On Sunday, July 23, 2017, Igor Korot <ikoro...@gmail.com> wrote: > > Is "IF" operator not supported by PostgreSQL > IF is pl/pgsql, not SQL. David J.

Re: [GENERAL] Postgres csv logging

2017-07-21 Thread David G. Johnston
tion - parse. The subsequent action is "execute" the contents of the SELECT that is now in the active state of the session. If the above is correct the docs could be more clear since I'd agree that your interpretation of the field seems more logical - though knowing initial state is quite useful in its own right. David J.

Re: [GENERAL] Backward compatibility

2017-07-21 Thread David G. Johnston
ly mitigate the need to have this kind of discussion. Since it is always going to be "0" we simply omit printing it. David J.

Re: [GENERAL] Backward compatibility

2017-07-20 Thread David G. Johnston
On Thursday, July 20, 2017, David G. Johnston <david.g.johns...@gmail.com> wrote: > On Thursday, July 20, 2017, Igor Korot <ikoro...@gmail.com > <javascript:_e(%7B%7D,'cvml','ikoro...@gmail.com');>> wrote: > >> Hi, David, >> >> On Thu, Jul 20, 2017 at

Re: [GENERAL] Backward compatibility

2017-07-20 Thread David G. Johnston
On Thursday, July 20, 2017, Igor Korot <ikoro...@gmail.com> wrote: > Hi, David, > > On Thu, Jul 20, 2017 at 10:23 PM, David G. Johnston > <david.g.johns...@gmail.com <javascript:;>> wrote: > > On Thu, Jul 20, 2017 at 7:13 PM, Igor Korot <iko

Re: [GENERAL] Backward compatibility

2017-07-20 Thread David G. Johnston
ng else? > ​SHOW server_version_num; 90124​ should be the result (don't have that version installed to copy-paste) 90506 is the version I have at my fingertips. David J.

  1   2   3   4   5   6   7   8   9   10   >