Re: Set role dynamically from proc

2017-11-22 Thread David G. Johnston
On Wed, Nov 22, 2017 at 7:52 AM, Durumdara wrote: > Now the "set role" uses the "variable name", and not the "value of the > variable". > > This is what I don't like in this lang. I need to write a special variable > name to "force" to use it, and not other thing. > I don't

Re: WAL reducing size

2017-12-04 Thread David G. Johnston
On Mon, Dec 4, 2017 at 8:50 AM, sql2pg wrote: > Is Postgres removes the committed transaction after archive. LIke in SQL > Server , which removes the committed transactions after taking Log backup. > If I understand correctly, yes - eventually. The docs explain the

Re: Does the delete+insert is fater and less cpu consumer than update?

2017-12-14 Thread David G. Johnston
On Thu, Dec 14, 2017 at 3:08 PM, hmidi slim wrote: > I didn't make any test for the performance between them and I want first > of all to know if the update consumes more cpu in case of a large amount of > data and with table with join. > Clearing the entire table, via

Re: Re: PostgreSQL needs percentage function

2017-12-18 Thread David G. Johnston
On Mon, Dec 18, 2017 at 9:13 AM, Nick Dro wrote: > > Hi, > I know how to implement this. It's not the issue. > It's very easy to implement absolute value as well yet still PostgreSQL > gives abs(x) function which is build in function. > My claim is that if there is a

Re: AWS Aurora and PG 10

2017-12-19 Thread David G. Johnston
On Tue, Dec 19, 2017 at 9:59 AM, Tory M Blue wrote: > Actually in us-west-1 9.x is not even available > ​You seem to be confused as to both PostgreSQL versioning and AWS offerings.​ I could deploy a 9.6.5 (one patch release behind the current 9.6 release) to us-west-1 right

Re: If table have an inclusion with LIKE what happens to triggers?

2017-12-13 Thread David G. Johnston
On Wed, Dec 13, 2017 at 11:21 AM, Göran Hasse wrote: > Is there any way to inherit also > the triggers from the common_field table? > ​No ​ > Or must I place triggers on all tables? > ​Yes​ ​ ​The docs cover what is able to be copied and triggers are not mentioned.

Re: a back up question

2017-12-05 Thread David G. Johnston
On Tue, Dec 5, 2017 at 2:52 PM, Martin Mueller < martinmuel...@northwestern.edu> wrote: > Are there rules for thumb for deciding when you can dump a whole database > and when you’d be better off dumping groups of tables? I have a database > that has around 100 tables, some of them quite large,

Re: Size of pg_multixact/members increases 11355

2017-12-12 Thread David G. Johnston
On Tue, Dec 12, 2017 at 2:52 AM, Yogesh Sharma wrote: > Dear All, > > I am using PostgreSQL 9.3.6 version and PGDATA pg_multixact.members folder > size is increased to around 3GB. How to reduce this folder size and how to > fix this issue? > Is it realted to poatgres

Re: Why the planner does not use index for a large amount of data?

2017-12-06 Thread David G. Johnston
On Wed, Dec 6, 2017 at 7:37 AM, hmidi slim wrote: > Hi, > When I used explain I found that the query planner use a seq scan to > execute a query on a table containing about 2 millions rows.However I'm > creating an index.Why does the planner uses seq scan in place of index

Re: [GENERAL] Full text search with plain input

2018-05-04 Thread David G. Johnston
On Friday, May 4, 2018, Havasvölgyi Ottó wrote: > so that it matches (with less rank) even if one of its words match ? > That seems to be what "ts_rank" provides. David J.

Re: [GENERAL] Full text search with plain input

2018-05-04 Thread David G. Johnston
On Friday, May 4, 2018, Havasvölgyi Ottó wrote: > > Now I am thinking about splitting the input text myself to terms, then > searching and ranking the documents for each term. > Maybe do: replace(input_text, ' ', ' | ') David J.

Re: psycopg2.DataError: invalid input syntax for integer: ""

2018-05-07 Thread David G. Johnston
On Sunday, May 6, 2018, tango ward wrote: > Yes, my apologies. > > May I also ask if there's a limitation for the number of timestamp with > timezone fields in a table? > Not one that is likely to matter in practice. There's a page discussing limitations on the

Re: psycopg2.DataError: invalid input syntax for integer: ""

2018-05-06 Thread David G. Johnston
On Sunday, May 6, 2018, tango ward wrote: > cur_p.execute(""" > > INSERT INTO a_recipient (created, mod, agreed, address, > honor,) > VALUES (%s, %s)""", (current_timestamp, current_timestamp, > current_timestamp, '', '')) > > That code

Re: void function and view select

2018-05-07 Thread David G. Johnston
On Mon, May 7, 2018 at 6:52 AM, Philipp Kraus wrote: > Hello, > > I have got a complex query with a dynamic column result e.g.: > > select builddata('_foo‘); > select * from _foo; > > The first is a plsql function which creates a temporary table, but the >

Re: psycopg2.DataError: invalid input syntax for integer: ""

2018-05-07 Thread David G. Johnston
On Mon, May 7, 2018 at 12:28 AM, tango ward wrote: > I think I've found the culprit of the problem. > > I have a field which is varchar from the source DB while on the > destination DB its integer. > > Reading the documentation: http://www.postgresqltutorial. >

Re: psycopg2.DataError: invalid input syntax for integer: ""

2018-05-07 Thread David G. Johnston
On Mon, May 7, 2018 at 6:35 AM, Adrian Klaver wrote: > >> Not sure but I'm thinking you at least need to add single >> quotes around the %s symbols. That doesn't really explain >> the integer input error though I'm not familiar with

Re: 10.4 upgrade, function markings, and template0

2018-05-14 Thread David G. Johnston
On Mon, May 14, 2018 at 1:42 PM, Dominic Jones wrote: > Good afternoon, > > The PostgreSQL 10.4 upgrade involves changes to some function markings > (see release notes, E.1.2, second and third bullet points for specifics). > One way to make these changes is to use `ALTER

Re: Query ID Values

2018-05-14 Thread David G. Johnston
On Monday, May 14, 2018, tango ward wrote: > > May I ask an advice on how to approach this? > I can't make heads nor tails of your description...but there isn't IF in SQL. But you may get some mileage out of simple joins. David J.

Re: Query ID Values

2018-05-14 Thread David G. Johnston
I'd bottom-post, as is the convention for these lists, but it seems pointless now... CASE *expression* WHEN *value* THEN *result* [WHEN ...] [ELSE *result*] END Try that where expression is the %s. The values and results are simple literals. And you compare the result of the

Re: Run external command as part of an sql statement ?

2018-05-07 Thread David G. Johnston
On Mon, May 7, 2018 at 2:35 PM, David Gauthier wrote: > Hi: > > At the psql prompt, I can do something like... >"select \! id -nu" > ...to get the uid of whoever's running psql. > > I want to be able to run a shell command like this from within a stored >

Re: KeyError: self._index[x]

2018-05-07 Thread David G. Johnston
On Monday, May 7, 2018, tango ward wrote: > > cur_t.execute(""" > SELECT TRANSLATE(snumber, ' ', '') > FROM sprofile """) > > # This will result in KeyError > for row in cur_t: > print row['snumber'] > > # This works fine > for row in cur_t:

Re: KeyError: self._index[x]

2018-05-07 Thread David G. Johnston
On Monday, May 7, 2018, tango ward wrote: > I didn't know it. Is it only in psycopg2 that the name of the columns > will use the name of the function? > The server assigns column names - hence the advice to use psql to investigate SQL issues more easily since there is

Re: Concatenate 2 Column Values For One Column

2018-05-08 Thread David G. Johnston
On Tue, May 8, 2018 at 7:17 PM, tango ward wrote: > I am trying to concatenate the value of column firstname and lastname from > source DB to name column of destination DB. > > (SELECT CONCAT(first_name, ',', last_name) AS > name FROM lib_author

Re: Concatenate 2 Column Values For One Column

2018-05-08 Thread David G. Johnston
On Tue, May 8, 2018 at 7:44 PM, David G. Johnston < david.g.johns...@gmail.com> wrote: > On Tue, May 8, 2018 at 7:17 PM, tango ward <tangowar...@gmail.com> wrote: > >> I am trying to concatenate the value of column firstname and lastname >> from source DB to

Re: Enhancement to psql command, feedback.

2018-05-09 Thread David G. Johnston
On Wed, May 9, 2018 at 6:44 AM, John McKown wrote: > Again, this is just a discussion point. And I'm quite willing to admit > defeat if most people don't think that it is worth the effort. > ​-1, at least per the example. I would not want "-U postgres" inside the

Re: New install of 9.5.12 missing default PostgreSQL DB

2018-05-09 Thread David G. Johnston
On Wed, May 9, 2018 at 8:05 PM, Chandru Aroor wrote: > Yes, the service shows as running. But I don't have a Server to connect > to! > ​I have to imagine you can add a server to pgAdmin...try host: localhost and port: 5432 David J.

Re: Domain based on TIMEZONE WITH TIME ZONE

2018-05-10 Thread David G. Johnston
On Thu, May 10, 2018 at 9:13 AM, Ben Hood wrote: > On 10 May 2018, at 15:12, Vick Khera wrote: > > On Thu, May 10, 2018 at 7:31 AM, Ben Hood wrote: > >> Or are we saying that domains are one way of achieving the timestamp >> hygiene, but

Re: Selecting strict, immutable text for a composite type.

2018-05-10 Thread David G. Johnston
On Thu, May 10, 2018 at 2:16 PM, Steven Lembark wrote: > exclude using gist > ( > locationusing =, > effective using && > ) > Have you installed the btree-​gist extension? https://www.postgresql.org/docs/10/static/btree-gist.html Not sure

Re: Selecting strict, immutable text for a composite type.

2018-05-10 Thread David G. Johnston
On Thursday, May 10, 2018, Steven Lembark wrote: > > Q: Why does it work with enums? Guessing because enums are not composites; they are scalar and most scalar types in core seem to be covered by the extension. > e.g., If I create a type foo_t as enum (...) and install

Re: cursor empty

2018-05-08 Thread David G. Johnston
On Tue, May 8, 2018 at 6:36 AM, Adrian Klaver wrote: > >> select * from vectorize('myvec'); >> fetch all from myvec; >> >> Can you explain me, which part is wrong? >> > > I am going to say: > > perform pivottable( ... > >

Known Bugs on Postgres 9.5

2018-05-05 Thread David G. Johnston
On Friday, May 4, 2018, Anudeep Gudipelli wrote: > I would like to know the known bugs for v9.5 and also v9.6, is there any > place where I can check? > I think as a whole the project does a good job of fixing known bugs shortly after they are reported. There

Re: Combining \i and \copy in psql

2018-05-15 Thread David G. Johnston
On Tue, May 15, 2018 at 8:30 AM, Rhys A.D. Stewart wrote: > Greetings, > > I have a query in a .sql file and I'd like to use \i to execute it and > \copy to save it to a csv file. Is there any way to combine the two? > > Something along the lines of: > > \copy \i

Re: Aggregate functions with FROM clause and ROW_COUNT diagnostics

2018-05-21 Thread David G. Johnston
On Mon, May 21, 2018 at 5:54 AM, Alexey Dokuchaev wrote: > result := json_agg(_) FROM ( > SELECT foo, bar, baz ... > FROM t1, t2, t3 WHERE ...) AS _; -- this works fine > > GET DIAGNOSTICS retcode = ROW_COUNT;-- always returns 1 > > I'd expected

Re: [GENERAL] Postgre compatible version with RHEL 7.5

2018-05-21 Thread David G. Johnston
On Sun, May 20, 2018 at 10:15 PM, Deepti Sharma S < deepti.s.sha...@ericsson.com> wrote: > Hello Team, > > Can you please let us know what postgre version is compatible with > RHEL7.5? We are currently using Postgre version 9.6.6. > ​9.6.6 is compatible but not supported - the current supported

Re: PostgreSQL backup issue

2018-05-22 Thread David G. Johnston
On Tuesday, May 22, 2018, Jayadevan M wrote: > pg_basebackup ... | tee -- Also, the output from pg_basebackup does not > get logged in $logfile even on those days when the backup works fine. > I would conclude that pg-basebackup is placing its output in stderr

Re: Insert data if it is not existing

2018-05-23 Thread David G. Johnston
On Wednesday, May 23, 2018, Adrian Klaver wrote: > >> '''INSERT INTO my_table(name, age) >> SELECT %s, %s >> WHERE NOT EXISTS(SELECT name FROM my_table WHERE name=%s)''', ('Scott', >> 23) >> >> > I doubt that worked, you have three parameter markers(%s) and two >

Re: Insert data if it is not existing

2018-05-23 Thread David G. Johnston
On Wednesday, May 23, 2018, tango ward <tangowar...@gmail.com> wrote: > > On Thu, May 24, 2018 at 9:09 AM, David G. Johnston < > david.g.johns...@gmail.com> wrote: > >> On Wednesday, May 23, 2018, tango ward <tangowar...@gmail.com> wrote: >> >

How do I copy an element of composite type array into csv file?

2018-05-23 Thread David G. Johnston
On Wednesday, May 23, 2018, a <372660...@qq.com> wrote: > Thank you very much. > > BTW, may I ask if I would like to do the opposite that copy csv file > content into the first element, how should I do it?? > > COPY B(Ay[1]) > from 'E:/products_199.csv' DELIMITER ',' CSV HEADER; > you cannot

Re: Insert data if it is not existing

2018-05-23 Thread David G. Johnston
On Wednesday, May 23, 2018, tango ward wrote: > Thanks masters for responding again. > > I've tried running the code: > > INSERT INTO my_table(name, age) > SELECT name, age > WHERE NOT EXISTS(SELECT name FROM my_table WHERE name= name) > > > this doesn't give me error but

Re: Insert data if it is not existing

2018-05-23 Thread David G. Johnston
On Wednesday, May 23, 2018, tango ward wrote: > > > curr.pgsql.execute(''' > INSERT INTO my_table(name, age) > SELECT %s, %s > WHERE NOT EXISTS(SELECT name FROM my_table WHERE name= name) > ''', ('Scott', 23)) > So, WHERE name = name is ALWAYS true and so as long as there

Re: Insert data if it is not existing

2018-05-23 Thread David G. Johnston
If you are going to post so many messages can you please observe the bottom-post and trim convention used of this mailing list. On Wednesday, May 23, 2018, tango ward wrote: > Tried it, but it still I am not inserting data into the table. > tried what? David J.

Re: RE: RE: How do I select composite array element that satisfy specific conditions.

2018-05-23 Thread David G. Johnston
On Wed, May 23, 2018 at 6:50 AM, a <372660...@qq.com> wrote: > > That is only by saying, the actual information could be much more, and all > of them are not in some way, "aligned". > ​Not sure what you are getting at here - "related" is generally the better term and usually during modeling one

Re: case statement within insert

2018-05-25 Thread David G. Johnston
On Friday, May 25, 2018, tango ward wrote: > > WHEN code like '%%PE%%' or code like '%%NSTP%%' > > I am getting TypeError: not all arguments converted during string > formatting. > > Any advice pls? > Unclear how to inject percent signs in the query string here.

Re: computing z-scores

2018-05-24 Thread David G. Johnston
On Thursday, May 24, 2018, Ron wrote: > On 05/24/2018 10:15 AM, Martin Mueller wrote: > >> You construct a z-score for a set of values by subtracting the average >> from the value and dividing the result by the standard deviation. I know >> how to do this in a two-step

Re: computing z-scores

2018-05-24 Thread David G. Johnston
On Thursday, May 24, 2018, David G. Johnston <david.g.johns...@gmail.com> wrote: > On Thu, May 24, 2018 at 8:15 AM, Martin Mueller < > martinmuel...@northwestern.edu> wrote: > >> You construct a z-score for a set of values by subtracting the average >> from

Re: computing z-scores

2018-05-24 Thread David G. Johnston
On Thu, May 24, 2018 at 8:15 AM, Martin Mueller < martinmuel...@northwestern.edu> wrote: > You construct a z-score for a set of values by subtracting the average > from the value and dividing the result by the standard deviation. I know > how to do this in a two-step procedure. First, I compute

Re: Parameter placeholders, $n vs ?

2018-05-24 Thread David G. Johnston
On Thursday, May 24, 2018, Lele Gaifax wrote: > > So the questions: is the '?' style placeholder a supported variant? and if > so, > should the ParamRef doc tell something about that? > PostgreSQL's Prepare statement doesn't accept question mark as a parameter symbol, and

Re: Performance opportunities for write-only audit tables?

2018-05-24 Thread David G. Johnston
On Thursday, May 24, 2018, Andrew Bartley wrote: > Hi, > > The two main techniques we use are. > > The idea here is to backup the rest of your DB to one backup regime and > the log tables to another. We set it up so at the end of the day the > current log table is backed up

Re: Control PhoneNumber Via SQL

2018-05-15 Thread David G. Johnston
On Tuesday, May 15, 2018, tango ward wrote: > Sorry for bumping this email. > > I would just like to clarify regarding regexp_replace: > > WHEN mobilenumber ~'^9[0-9]' AND LENGTH(mobilenumber) = 10 > THEN regexp_replace(mobilenumber, '', '+63') > > If the pattern is empty

Re: sql function with empty row

2018-05-16 Thread David G. Johnston
On Wed, May 16, 2018 at 11:49 AM, Philipp Kraus < philipp.kr...@tu-clausthal.de> wrote: > I have tested it on my data and it works also, but that is a little bit > confusing, because imho setof is >= 0 rows and > without setof it is [0,1]. ​Without setof it will always return exactly 1 row,

Re: Control PhoneNumber Via SQL

2018-05-15 Thread David G. Johnston
On Tuesday, May 15, 2018, tango ward wrote: > > > I can access the index 1 of the output list to get the +639078638001. I > think this has been explained already by Sir Adrian in my previous question > about the about being shown as list. I'll review that. > Last time you

Re: How do I copy an element of composite type array into csv file?

2018-05-23 Thread David G. Johnston
On Wed, May 23, 2018 at 7:03 AM, a <372660...@qq.com> wrote: > Thank you so much, did you mean the section 8.15.6?? ​Yes. ​

Re: Insert data if it is not existing

2018-05-23 Thread David G. Johnston
On Wednesday, May 23, 2018, tango ward wrote: > I just want to ask if it's possible to insert data if it's not existing > yet. > This seems more like a philosophical question than a technical one... ​but the answer is yes: CREATE TABLE test_t (a varchar, b varchar, c

Re: Semantics around INSERT INTO with SELECT and ORDER BY.

2018-06-12 Thread David G. Johnston
On Tuesday, June 12, 2018, Steve Krenzel wrote: > This is relevant for tables that have a column with a SERIAL type, I need > to guarantee that the relative ordering remains the same as the ordering of > the selected result set. > The logical insertion order, and thus the sequence values, will

Re: Query hitting empty tables taking 48 minutes

2018-06-08 Thread David G. Johnston
On Fri, Jun 8, 2018 at 9:17 AM, Robert Creager wrote: > A nightly VACUUM FULL which ran based on heuristics resolved the problem. > This would seem to point to a db problem more than an app problem? I’m > unsure how the app could have an affect of this magnitude on the database, > although I’d

Re: Logging

2018-06-12 Thread David G. Johnston
On Tuesday, June 12, 2018, Andrew Bartley wrote: > > > On Wed, 13 Jun 2018 at 12:43 Laurenz Albe > wrote: > >> >> log_min_duration_statement = 0 >> > [...] > > log_min_duration_statement -1 > You've disabled statement logging altogether. The zero value you were directed to use is what causes

Re: Clarifying "timestamp with time zone"

2018-06-15 Thread David G. Johnston
On Fri, Jun 15, 2018 at 12:24 PM, Jeremy Finzel wrote: > So it seems to me that "timestamp with time zone" is a misnomer in a big > way, and perhaps it's worth at least clarifying the docs about this, or > even renaming the type or providing an aliased type that means the same > thing, something

Re: Query hitting empty tables taking 48 minutes

2018-06-07 Thread David G. Johnston
On Thu, Jun 7, 2018 at 3:02 PM, Robert Creager wrote: > Executing with the job_id shown in the stats of the empty table below > (didn’t change after bunches of executions). The job_entry table has very > ephemeral data in general. > > tapesystem=# EXPLAIN ANALYZE EXECUTE

Re: Drop Default Privileges?

2018-06-19 Thread David G. Johnston
On Tue, Jun 19, 2018 at 11:31 AM, Pavan Teja wrote: > Once I tried finding the list of default privileges, but left with no clue. > ​Start here: https://www.postgresql.org/docs/10/static/catalog-pg-default-acl.html David J. ​

Re: Is there a way to be notified on the CREATE TABLE execution?

2018-06-19 Thread David G. Johnston
On Tuesday, June 19, 2018, Igor Korot wrote: > Hi, ALL, > Consider a scenario: > > 1. A software that uses libpq is executing. > 2. Someone opens up a terminal and creates a table. > 3. A software needs to know about this new table. > I'd start here:

Re: Load data from a csv file without using COPY

2018-06-19 Thread David G. Johnston
https://lists.postgresql.org/unsubscribe/ On Tuesday, June 19, 2018, Asif Ali wrote: > please just tell me the site i will do it right away and i have marked it > junked so many times , i will keep spamming it until my email address is > removed from the list > > Bye > >

Re: Drop Default Privileges?

2018-06-19 Thread David G. Johnston
On Tuesday, June 19, 2018, Louis Battuello wrote: > Is it possible to drop default privileges > https://www.postgresql.org/docs/10/static/sql-alterdefaultprivileges.html ? David J.

Re: Load data from a csv file without using COPY

2018-06-19 Thread David G. Johnston
On Tue, Jun 19, 2018 at 1:16 PM, Ravi Krishna wrote: > In order to test a real life scenario (and use it for benchmarking) I want > to load large number of data from csv files. > The requirement is that the load should happen like an application writing > to the database ( that is, no COPY

Re: Load data from a csv file without using COPY

2018-06-19 Thread David G. Johnston
On Tue, Jun 19, 2018 at 2:17 PM, Ravi Krishna wrote: > > > > I think an easy approach would be to COPY the CSV files into a separate > database using psql's \copy command and then pg_dump that as separate > insert statements with pg_dump —inserts. > > > > This was my first thought too. However,

Re: Insert UUID GEN 4 Value

2018-05-30 Thread David G. Johnston
On Wednesday, May 30, 2018, tango ward wrote: > > Okay I will try it. >> > > When I tried it, I am getting an error: Invalid input syntax for UUID: > uuid_generate_v4(), > Avoid references to "it" and just show the code you tried to run. David J.

Re: existence of a savepoint?

2018-05-29 Thread David G. Johnston
On Tue, May 29, 2018 at 4:01 PM, Alvaro Herrera wrote: > On 2018-May-29, Stuart McGraw wrote: > > > Alternatively if there were a setting to tell Postgresql to > > follow the SQL standard behavior of overwriting rather stacking > > savepoints, that too would also solve my current problem I

Re: reduce number of multiple values to be inserted

2018-05-29 Thread David G. Johnston
On Tuesday, May 29, 2018, tango ward wrote: > > I will repeat the same process for 13 villages so that will be 117 of > values. I would like to know if there's a way to reduce the script? This > has to be done strictly via script. > > VALUES and CROSS JOIN might help but you haven't explained the

Re: existence of a savepoint?

2018-05-29 Thread David G. Johnston
On Tuesday, May 29, 2018, Stuart McGraw wrote: > But in my case I don't control the size of the input data > Not in production but you have an idea of both size and complexity and should be able to generate performance test scenarios, and related monitoring queries (system and service) to

Re: [HACKERS] Code of Conduct plan

2018-06-03 Thread David G. Johnston
On Sunday, June 3, 2018, George Neuner wrote: > On Sun, 03 Jun 2018 17:47:58 -0400, Tom Lane > wrote: > > >Benjamin Scherrey writes: > > > >> Another more specific factual question - have there been incidents > within > >> the active Postgresql community where behaviour by individuals who are

Re: [HACKERS] Code of Conduct plan

2018-06-04 Thread David G. Johnston
On Mon, Jun 4, 2018 at 7:06 AM, Adrian Klaver wrote: > On 06/03/2018 09:21 PM, David G. Johnston wrote: > >> >> That's pretty much par for the public dynamic of this community. And, as >> noted above, such a policy doesn't need the community at-large's appr

Re: How to get postmaster shut down time in postgres?

2018-06-04 Thread David G. Johnston
On Mon, Jun 4, 2018 at 6:44 AM, pavan95 wrote: > The main reason for my requirement is to find the time swing between server > stop and start. > ​Not all server stops are logged/evented (i.e., crashes), though by definition all successful starts are (or at least can be).​ David J.

Re: What specific circumstances trigger Autovacuum wraparound

2018-06-04 Thread David G. Johnston
On Monday, June 4, 2018, Daniel Lagerman wrote: > I have a pg 9.4.3 server that has one table with calculate age of about > 320 million, this is the oldest table in this database and therefore the > age of the DB is the same as the table. > It would be advisable to simply upgrade to 9.4.18 and

Re: Code of Conduct plan

2018-06-05 Thread David G. Johnston
On Tue, Jun 5, 2018 at 9:32 AM, Tom Lane wrote: > Yeah, personally I'm a bit worried about this too. The proposed CoC > does contain provisions to try to prevent misusing it, but whether those > are strong enough remains to be seen --- and it'll depend a good deal > on the judgment of the

Re: pg_stats avg_width and null_frac

2018-06-05 Thread David G. Johnston
On Tue, Jun 5, 2018 at 5:49 PM, Paul McGarry wrote: > Can anyone confirm that the "avg_width" reported in the pg_stats is the > avg_width not including any null rows? > ​Yes. https://github.com/postgres/postgres/blob/master/src/include/catalog/pg_statistic.h#L40 It actually is documented but

Re: Reset the cursor to start from the record 1

2018-06-05 Thread David G. Johnston
On Tue, Jun 5, 2018 at 2:08 PM, Igor Korot wrote: > Is there a function which just reset the record pointer to 1, so I can > reprocess > those records > ​? > ​While I haven't actually programmed using this API... The documentation doesn't seem to indicate the presence of a "record pointer", it

Re: Doing a \set through perl DBI ?

2018-06-06 Thread David G. Johnston
On Wednesday, June 6, 2018, David Gauthier wrote: > Hi: > > Is there a way to do the equivalent of a "\set foo 1" through perl dbi ? > I tried... > $dbh->do("\\set foo 1"); > and got a syntax error > > Of course, I'd also have to be able to access the value of foo once its > set. I'm

Re: Code of Conduct plan

2018-06-06 Thread David G. Johnston
On Wednesday, June 6, 2018, Tom Lane wrote: > Jeremy Schneider writes: > > My main feedback on the CoC is that it doesn't really say anything about > > what to do if the complaint is against a core team member. This was > > mentioned elsewhere in the email thread and I'm a bit surprised there's

Re: existence of a savepoint?

2018-05-27 Thread David G. Johnston
On Sunday, May 27, 2018, Stuart McGraw wrote: > Is there some way to to test if a savepoint of a given name > exists? Or better yet, the number of stacked savepoints of > that name? > A scan of the documentation doesn't show any commands or functions that would provide

Re: Whither 1:1?

2018-06-01 Thread David G. Johnston
On Fri, Jun 1, 2018 at 9:52 AM, Guyren Howe wrote: > It’s come to my attention that what seems an obvious and useful database > design pattern — 1:1 relations between tables by having a shared primary > key — is hardly discussed or used. > > It would seem to be a very simple pattern, and useful

Re: Insert UUID GEN 4 Value

2018-05-31 Thread David G. Johnston
On Wed, May 30, 2018 at 9:32 PM, tango ward wrote: > > On Thu, May 31, 2018 at 12:18 PM, David G. Johnston < > david.g.johns...@gmail.com> wrote: > >> On Wednesday, May 30, 2018, tango ward wrote: >>> >>> Okay I will try it. >>&

Re: Is there a way to be notified on the CREATE TABLE execution?

2018-06-20 Thread David G. Johnston
On Wed, Jun 20, 2018 at 1:02 PM, Alvaro Herrera wrote: > On 2018-Jun-20, Igor Korot wrote: > > > [quote] > > In order to create an event trigger, you must first create a function > > with the special return type event_trigger. This function need not > > (and may not) return a value; the return

Re: Postgres 10.4 crashing when using PLV8

2018-06-20 Thread David G. Johnston
On Wed, Jun 20, 2018 at 12:46 PM, Mukesh Chhatani wrote: > I am trying to use the PLV8 via function and while using the function > created via PLV8 in one of the create materialized view, postgres crashes, > attached is the log file with DEBUG5 turned on. > ​These are not the correct place to

Re: SQL Query never ending...

2018-06-20 Thread David G. Johnston
On Wed, Jun 20, 2018 at 3:34 PM, Fabrízio de Royes Mello < fabri...@timbira.com.br> wrote: > And use some external service like pastebin.com to send long SQL > statements. > ​Or just attach a text file - those are allowed on these lists. ​ David J.

Re: Not able to update some rows in a table

2018-07-02 Thread David G. Johnston
On Mon, Jul 2, 2018 at 8:38 AM, Marco Fochesato wrote: > anything else to make the situation more clear (like errors in the >> logfile, or anything else you think is relevant) >> > No errors in the GUI, no errors in PgAdmin.log > > I would suggest writing a self-contained script that creates the

Re: Not able to update some rows in a table

2018-07-02 Thread David G. Johnston
On Mon, Jul 2, 2018 at 8:59 AM, Marco Fochesato wrote: > > >> I would suggest writing a self-contained script that creates the table, >> inserts a single record, and updates that record. Present that for >> consideration along with a description or capture of the results of running >> the

Re: CSVQL? CSV SQL? tab-separated table I/O? RENAME COLUMN

2018-05-02 Thread David G. Johnston
On the whole this email is very confusing/hard-to-follow... On Wed, May 2, 2018 at 2:29 PM, Jim Michaels wrote: > what do you think about foreign data wrappers getting CSV file table I/O? > ​ > ​I don't understand the question...​ ​ > I had thought that CSVQL db could

Re: Surprised by index choice for count(*)

2018-05-01 Thread David G. Johnston
On Tue, May 1, 2018 at 8:46 AM, Rob Sargent wrote: > Should I be? I would have thought the pk would have been chosen v. > function index? > Indexes: > "segment_pkey" PRIMARY KEY, btree (id) > "useg" UNIQUE, btree (probandset_id, chrom, startbase, endbase) >

Re: Two things bit baffling in RDS PG

2018-05-03 Thread David G. Johnston
On Thu, May 3, 2018 at 1:18 PM, Ravi Krishna wrote: > I am playing around with RDS PG and I am not able to understand the > following: > > 1. The database name I created via RDS console is in upper case with no > quotes. From the remote machine via psql, > if I try to

Re: FK v.s unique indexes

2018-07-03 Thread David G. Johnston
On Tuesday, July 3, 2018, Rafal Pietrak wrote: > > ERROR: there is no unique constraint matching given keys for referenced > table "test2" > > > I cannot see any reasons why this functionality is blocked. > > In particular, contrary to what the ERROR says, the

Re: Question on the right way to think about order by

2018-07-03 Thread David G. Johnston
On Tuesday, July 3, 2018, Paula Kirsch wrote: > > When I think about order by in an aggregate statement, e.g. > > select string_agg(product, ' | ' order by product) from products; > > > is it correct to think of order by as a parameter passed to string_agg? > For a user it's simply the order

Re: Change column type macaddr to macaddr[]

2017-12-30 Thread David G. Johnston
On Saturday, December 30, 2017, Ertan Küçükoğlu wrote: > Hello, > > I am using PostgreSQL 9.6.6 on armv8l-unknown-linux-gnueabihf, compiled by > gcc (Raspbian 6.3.0-18+rpi1) 6.3.0 20170516, 32-bit > > I have a table with column name mac type macaddr. I need to change

Re: Intersection or zero-column queries

2017-12-21 Thread David G. Johnston
On Thu, Dec 21, 2017 at 4:53 PM, Victor Yegorov wrote: > postgres=# select except select; > -- > (2 rows) > postgres=# select intersect all select; > -- > (2 rows) > > Why is it so? > Should this be reported as a bug?.. ;) > ​The intersection case

Re: Intersection or zero-column queries

2017-12-21 Thread David G. Johnston
On Thu, Dec 21, 2017 at 5:08 PM, Victor Yegorov wrote: > > Also, intersection should not return more rows, than there're in the > sub-relations. > > Doh!, I think I got UNION into my mind somewhere in that... David J.

Re: Intersection or zero-column queries

2017-12-21 Thread David G. Johnston
On Thursday, December 21, 2017, Tom Lane wrote: > which would only be the right plan for UNION ALL. > > So yeah, it's wrong ... but personally I'm not terribly excited > about fixing it. Maybe somebody else wants to; but what's the > practical use? > How about just erroring

Re: String comparison problem in select - too many results

2018-01-10 Thread David G. Johnston
On Wednesday, January 10, 2018, Durumdara wrote: > > The PG is 9.4 on Linux, the DataBase encoding is: >ENCODING = 'UTF8' >LC_COLLATE = 'hu_HU.UTF-8' >LC_CTYPE = 'hu_HU.UTF-8' > > The collection rules for hu_HU.UTF-8 probably pretend symbols don't

Re: Multiple central connection service files

2018-01-11 Thread David G. Johnston
On Thu, Jan 11, 2018 at 9:23 AM, Curt Tilmes wrote: > The convention that many utilities that use such a config file have > adopted is allowing an additional > directory where more config sections are found, e.g. > $PGSYSCONFDIR/pg_service.conf.d/* > ​I already do this via

Re: creating a table in plpython?

2018-01-10 Thread David G. Johnston
On Wed, Jan 10, 2018 at 4:27 PM, Celia McInnis wrote: > Hi - Is it possible to create a table inside a plpython stored procedure? > If so, can you give an example of how to do so? > > ​Haven't used pl/python myself but...​

Re: Notify client when a table was full

2018-01-19 Thread David G. Johnston
On Fri, Jan 19, 2018 at 8:47 AM, hmidi slim wrote: > I need to be notified when the table is full to launch a script whis dumps > this table. > ​Please don't top post. You are going to need to explain the entire process is greater detail if you want help. As Raymond

Re: Use left hand column for null values

2018-01-19 Thread David G. Johnston
On Fri, Jan 19, 2018 at 8:46 AM, wrote: > I’m trying to fill up columns containing NULL with the most recent NOT > NULL value from left to right. > > Example: > > Select 2, 1, null, null, 3 > > Should be converted into > > 2, 1, 1, 1, 3 > > > > The following query works but I

Re: Notify client when a table was full

2018-01-19 Thread David G. Johnston
On Fri, Jan 19, 2018 at 8:34 AM, hmidi slim wrote: > Hi, > I'm looking for a function in postgresql which notify the client if a > table was full or not.So I found the function Notify > https://www.postgresql.org/docs/9.0/static/sql-notify.html. > This function send a

  1   2   3   4   5   6   7   8   9   10   >