Re: Restrict user to create only one db with a specific name

2020-03-06 Thread David G. Johnston
t to unexpected databases via the pg_hba.conf file. Why does userA need create database privileges? You could just have them log into an admin database and run a function that creates the database for them using function owner privileges then you can add whatever special logic you want to that function. David J.

Re: Restrict user to create only one db with a specific name

2020-03-06 Thread David G. Johnston
On Friday, March 6, 2020, David G. Johnston wrote: > On Fri, Mar 6, 2020 at 4:28 PM Tiffany Thang > wrote: > >> Hi, >> Is there a way in PostgreSQL 12 to restrict user to creating a database >> with a specific database name? >> >> > >> You cou

Re: How to set a value when NULL

2020-03-11 Thread David G. Johnston
e it's not working. I'm doing anything wrong > NULLIF does the inverse of what you want - you expression returns null if fieldna,e has a value of 0. COALESCE is what you want. Coalesce(fieldname, 0) — returns the first, non-null argument. David J.

Re: plperl syntax question

2020-03-12 Thread David G. Johnston
On Thursday, March 12, 2020, stan wrote: > > my $rv3 = spi_exec_query('$stmt'); > What am I doing wrong here? > Putting a variable name into a single-quoted string and expecting it to resolve to the contents of said variable instead of being treated as a literal. David J.

Re: plperl syntax question

2020-03-12 Thread David G. Johnston
On Thursday, March 12, 2020, Rob Sargent wrote: > > > On Mar 12, 2020, at 7:44 PM, stan wrote: > > On Thu, Mar 12, 2020 at 06:37:02PM -0700, David G. Johnston wrote: > > On Thursday, March 12, 2020, stan wrote: > > > my $rv3 = spi_exec_query('$s

Re: plperl syntax question

2020-03-12 Thread David G. Johnston
rrectly. The OP should (I think) be using a parameterized query instead of brute force string manipulation since this code is a prone to exploit. David J.

Re: Temporary tablespaces on a RAM disk

2020-03-17 Thread David G. Johnston
t either confirmed it is a bad idea nor the opposite. > There is a nice big bold warning callout in the documentation that covers this explicitly. https://www.postgresql.org/docs/12/manage-ag-tablespaces.html David J.

Re: Could postgres12 support millions of sequences? (like 10 million)

2020-03-19 Thread David G. Johnston
model will be used; and without that information useful comments pertaining to alternative implementations are difficult to formulate. David J.

Re: Could postgres12 support millions of sequences? (like 10 million)

2020-03-19 Thread David G. Johnston
On Thursday, March 19, 2020, Tom Lane wrote: > Michael Lewis writes: > > On Thu, Mar 19, 2020, 5:48 PM David G. Johnston < > david.g.johns...@gmail.com> > > wrote: > >> However, one other consideration with sequences: do you care that > >> PostgreS

Re: Could postgres12 support millions of sequences? (like 10 million)

2020-03-19 Thread David G. Johnston
> The other implementation detail to remember is: “Because nextval and setval calls are never rolled back, sequence objects cannot be used if “gapless” assignment of sequence numbers is needed.” David J.

Re: Could postgres12 support millions of sequences? (like 10 million)

2020-03-20 Thread David G. Johnston
existence at this moment”? David J.

Re: Could postgres12 support millions of sequences? (like 10 million)

2020-03-22 Thread David G. Johnston
into place in the trigger function. > not tested but something like: execute format('select nextval("obj_counter_%s_%s");', i_group, i_element) into strict c_seqval; or, more paranoidly: execute format('select nextval(%I);', format('obj_counter_%s_%s', i_group, i_element)) into strict c_seqval; David J.

Re: Loading 500m json files to database

2020-03-23 Thread David G. Johnston
ile into a variable and then just perform a normal insert (specifically, a VALUES (...), (...) variant). Since you can intermix psql and SQL you basically output a bloody long script, that has memory issues at scale - but you can divide and conquer - and then "psql --file bloody_long_script_part_1_of_10.psql". David J.

Re: How to plpgsql scripting

2020-03-25 Thread David G. Johnston
On Wednesday, March 25, 2020, Ekaterina Amez wrote: > > What's wrong with the syntax? Or is not possible to make a script and I > have to create a function to encapsulate my code? > This not working exactly the reason the “DO” command was created. David J.

Re: PLPGSQL: DECLARE more variable with same type at once

2020-03-25 Thread David G. Johnston
Ertek double precision; > > Do you know any other form? > > No other form is specified in the documentation. David J.

Re: PLPGSQL: when the local variable used and when the table field?

2020-03-25 Thread David G. Johnston
gt; > Do you know any info about the background? > https://www.postgresql.org/docs/12/plpgsql-implementation.html#PLPGSQL-VAR-SUBST David J.

Re: Database Cache Hit Ratio (Warning)

2020-03-31 Thread David G. Johnston
nd undefined query) really think higher percentages are worse or are you mis-communicating? David J.

Re: using a common key value on both sides of a union ?

2020-04-01 Thread David G. Johnston
On Wednesday, April 1, 2020, David Gauthier wrote: > psql (9.6.7, server 11.3) on linux > > I want to do something like this > (intentionally bad sql but will illustrate the need) > > select s.name,s.grade from students s where s.class='math' > union > sele

Re: Help to find-the-maximum-length-of-field-in-a-particular-column-in-all the tables

2020-04-02 Thread David G. Johnston
a parts being populated by a query against information_schema or the catalog. You’d need you something besdies pure sql (e.g., pl/pgsql) to do this. You may find it easier to just brute force things. David J.

Re: Fixing set-returning functions are not allowed in UPDATE after upgrade to Postgres 12

2020-04-03 Thread David G. Johnston
XPRESSIONS-SUBSCRIPTS update temprid set ContactFirstName =(xpath( '/E-Document/Document/DocumentParties/BuyerParty/ContactData/ContactFirstName/text()',x) )[1]::text David J.

Re: Database Cache Hit Ratio (Warning)

2020-04-03 Thread David G. Johnston
ovides information and is fairly cheap to capture and store. From the sounds of it you should probably continue capturing the data but turn off the alert. That way if there is a problem the data still exists to be considered. The metric itself does not measure something of critical importance. David J.

Re: psql show me the : and ask user input, when running one sql file

2020-04-05 Thread David G. Johnston
and explain what may be wrong with that statement or portion of the file. Removing stuff instead of just commenting it out is recommended. David J.

Re: psql show me the : and ask user input, when running one sql file

2020-04-05 Thread David G. Johnston
eters (https://www.postgresql.org/docs/12/app-psql.html) > > libpq understands URI connection strings: https://www.postgresql.org/docs/12/libpq-connect.html#LIBPQ-CONNSTRING David J.

Re: How to unnest nested arrays

2020-04-06 Thread David G. Johnston
gets enough information, or has better tooling available, to handle this more gracefully. JSON maybe...though at that point you may want to just consider changing the model. David J.

Re: extract property value from set of json arrays

2020-04-06 Thread David G. Johnston
tps://www.postgresql.org/docs/12/functions-json.html Then work out something that either works or gets you at least close. If you are just close post the work done to date and any relevant points of confusion. I'll then likely be willing and able to fill in the missing gap(s) and provide a relevant explanation. You should formulate your query so that it doesn't require CREATE TABLE. WITH vals (v) AS (VALUES (''::json)) SELECT vals.v FROM vals; makes experimenting very easy. Also, indicate which version of PostgreSQL you are working with. David J.

Re: what happens when you issue ALTER SERVER in a hot environment?

2020-04-06 Thread David G. Johnston
good that actively running processes will keep going. > If you alter a password the old one is by definition no longer good...but it doesn’t matter because authentication only happens once - during login. David J.

Re: order by not working in view ?

2020-04-09 Thread David G. Johnston
On Thursday, April 9, 2020, David Gauthier wrote: > psql (9.6.7, server 11.3) on linux > > In the copy/paste below, first 2 lines returned by a select on the view, > why didn't it sort on start_datetime correctly ? I would think that the > one started on 04-08 would come bef

Re: timestamp and timestamptz

2020-04-15 Thread David G. Johnston
Zone parameter, and is converted to UTC using the offset for the timezone zone. """ https://www.postgresql.org/docs/12/datatype-datetime.html David J.

Re: how to slow down parts of Pg

2020-04-21 Thread David G. Johnston
at the space is going to be filled in again soon so it doesn't normally make sense to "resize the array". David J.

Re: parameter limit

2020-04-23 Thread David G. Johnston
cation for the Bind Message in the documentation: https://www.postgresql.org/docs/12/protocol-message-formats.html Int16 The number of parameter values that follow David J.

Re: relationship of backend_start, query_start, state_change

2020-04-23 Thread David G. Johnston
ld clear things up considerably. https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-ACTIVITY-VIEW David J.

Re: relationship of backend_start, query_start, state_change

2020-04-23 Thread David G. Johnston
On Thu, Apr 23, 2020 at 9:55 AM David G. Johnston < david.g.johns...@gmail.com> wrote: > On Thu, Apr 23, 2020 at 9:37 AM Si Chen > wrote: > >> Hello, >> >> I'm looking at my pg_stat_activity and trying to figure out what is >> causing some of these pr

Re: relationship of backend_start, query_start, state_change

2020-04-23 Thread David G. Johnston
On Thu, Apr 23, 2020 at 9:58 AM Olivier Gautherot wrote: > Hi David, > > On Thu, Apr 23, 2020 at 6:55 PM David G. Johnston < > david.g.johns...@gmail.com> wrote: > >> On Thu, Apr 23, 2020 at 9:37 AM Si Chen >> wrote: >> >>> Hello, >>> &g

Re: Could Not Connect To Server

2020-04-23 Thread David G. Johnston
database from backup because there is a good chance this wasn't done properly and you presently have a corrupted database on your hard drive. David J.

Re: Ned to understand why all the idle connections

2020-04-23 Thread David G. Johnston
On Thursday, April 23, 2020, David Gauthier wrote: > Hi: > > psql (9.6.7, server 11.3) on linux > > I have what appear to be a log of idle connections to my DB. Query of > pg_stat_activity indicates well over half (127/206) are like this... > > > dvdb=# select s

Re: Could Not Connect To Server

2020-04-23 Thread David G. Johnston
System from Time Machine/(backup). > > And was that Time Machine backup made while the server was offline? If not, and you didn't take any explicit steps to backup and restore the database itself, then your database may be corrupted and thus unable to boot. The log file should indicate whether that is the case. David J.

Re: Ned to understand why all the idle connections

2020-04-23 Thread David G. Johnston
On Thu, Apr 23, 2020 at 11:52 AM David Gauthier wrote: > Thanks! > And an example of connection pooling is pgBouncer ? > >> >> It does describe itself as being a "Lightweight connection pooler for PostgreSQL" ... https://www.pgbouncer.org/ David J.

Re: Question on banner display after PG initial connection

2020-04-23 Thread David G. Johnston
of this line “*SSL connection (protocol: > TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: > off)”?* > > > Specifically, no. But passing "--quiet" as a command line option to psql should suppress it, as well as some other stuff. David J.

Re: Ned to understand why all the idle connections

2020-04-23 Thread David G. Johnston
Please don't top-post; and this is a fairly rude hijack posting given that you already have a thread going, from today no less, where you've basically asked this very same question. On Thu, Apr 23, 2020 at 2:18 PM Si Chen wrote: > Hello David & David, > > I have a simi

Re: Fw: Re: Could Not Connect To Server

2020-04-23 Thread David G. Johnston
; > The "sudo" in Rob's answer wasn't optional. Attempting to use sudo should require the OS Admin Password David J.

Re: psql \copy

2020-04-24 Thread David G. Johnston
On Fri, Apr 24, 2020 at 8:55 AM Steve Clark wrote: > Hello, > > I am using psql to copy data extracted from an InfluxDB in csv format into > postgresql. > I have a key field on the time field which I have defined as a bigint > since the time I get > from InfluxDB is an epoch time. > > My question

Re: Detecting renamed columns via pgouput in logical replication ?

2020-04-26 Thread David G. Johnston
On Thursday, April 16, 2020, Andreas Andreakis wrote: > > > Does this allow to detect column renames ? > “The database schema and DDL commands are not replicated“ https://www.postgresql.org/docs/current/logical-replication-restrictions.html David J.

Re: Detecting renamed columns via pgouput in logical replication ?

2020-04-27 Thread David G. Johnston
Please don’t top-post. On Monday, April 27, 2020, Andreas Andreakis wrote: > Thx for replying David. > > According to https://www.postgresql.org/docs/10/protocol-logicalrep- > message-formats.html it looks like certain schema information is embedded > via pgoutput such as column

Re: Detecting renamed columns via pgouput in logical replication ?

2020-04-27 Thread David G. Johnston
On Monday, April 27, 2020, David G. Johnston wrote:. > > > Are there plans to add comprehensive schema change detection abilities via >> logical replication ? either by embedding more information into pgoutput or >> perhaps by embedding the schema DDLs ? >> > >

Re: Why is a check constraint not working ?

2020-04-29 Thread David G. Johnston
On Wed, Apr 29, 2020 at 8:17 AM David Gauthier wrote: > > Check constraints: > "dvm_events_status_check" CHECK (status::text = ANY > (ARRAY['passed'::character varying, 'failed'::character varying, > NULL::character varying]::text[])) >

Re: Checking for Presence of Required Libraries Fails during PostgreSQL Upgrade

2020-05-02 Thread David G. Johnston
tation does describe the step of porting extension libraries. It says you need to do that before you run pg_upgrade and ensure that whatever is being installed onto the new server is binary compatible. It even says explicitly that pg_upgrade cannot do this for you. https://www.postgresql.org/docs/12/pgupgrade.html David J.

Re: jsonb unique constraints

2020-05-05 Thread David G. Johnston
error at the first '(' around 'report ->>'. > Documentation says constraints must reference column names - so no. You can probably get what you are after by directly creating a unique index though - those allow expressions. David J.

Re: Wrong PostgreSQL Plan

2020-05-05 Thread David G. Johnston
ective of default_statistics_target, is probably a good thing to try. David J.

Re: New Role drop with Grant/Revokes stop working after subsequent runs

2020-05-06 Thread David G. Johnston
at seems to be a superior alternative. David J. > >

Re: Explain plan changes - IN CLAUSE ( Passing direct values Vs INNER Query )

2020-05-07 Thread David G. Johnston
pi.app_id = pa.app_id AND pi.user_id = '317079413683604' ) ORDER BY pa.process_instance_id, pa.created limit 50; I'm unsure exactly how this will impact the plan choice but it should be an improvement, and in any case more correctly defines what it is you are looking for. David J.

Re: Postgres 11.6-2 to 11.7 worth the upgrade?

2020-05-07 Thread David G. Johnston
> the versions? > You can peruse the release notes online but regardless the project policy is that you should never not apply a minor release update (though we also don't use 11.6-2 version numbering...). David J.

Re: wal_sender_timeout default

2020-05-07 Thread David G. Johnston
onfig-replication.html#RUNTIME-CONFIG-REPLICATION-SENDER David J.

Re: Explain plan changes - IN CLAUSE ( Passing direct values Vs INNER Query )

2020-05-07 Thread David G. Johnston
of joining), maybe, does it take the effort of constructing a minimally necessary output column set. David J.

Re: Explain plan changes - IN CLAUSE ( Passing direct values Vs INNER Query )

2020-05-07 Thread David G. Johnston
ted should define the traversal order...) so that the output of the nested loop ends up being (max 2 x 50) 100 entries which are then sorted and only the top 50 returned. Whether the executor could but isn't doing that here or isn't programmed to do that (or my logic is totally off) I do not know. David J.

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

2020-05-08 Thread David G. Johnston
On Fri, May 8, 2020 at 9:26 AM 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 inv

Re: Thoughts on how to avoid a massive integer update.

2020-05-08 Thread David G. Johnston
new table and dropping the old one would be the best solution when taken in isolation. David J.

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

2020-05-08 Thread David G. Johnston
ry SQL command, and then must periodically call the function PQnotifies to find out whether any notification events have been received.". IOW, the interface for the client is still a polling interface its just that with LISTEN the event is transient and in-memory only (on the server) and thus h

Re: Thoughts on how to avoid a massive integer update.

2020-05-08 Thread David G. Johnston
me on the table holding the PK half of the relationship. David J.

Re: Thoughts on how to avoid a massive integer update.

2020-05-08 Thread David G. Johnston
be stored (OP has not specified but think using an integer value of someones social security number as a key). The FK side of the relationship equality has the same illegal data values problem and need to be changed too. David J.

Re: Thoughts on how to avoid a massive integer update.

2020-05-08 Thread David G. Johnston
On Fri, May 8, 2020 at 1:51 PM Rob Sargent wrote: > > On May 8, 2020, at 2:43 PM, David G. Johnston > wrote: > > On Fri, May 8, 2020 at 1:41 PM Rob Sargent wrote: > >> My understanding is the keys in the info_table need to change. That >> causes the very expensi

Re: How to restore database to previous state

2020-05-10 Thread David G. Johnston
te to a point sometime before the target time and then restore until you attain the target time. David J.

Re: Enforcing uniqueness on [real estate/postal] addresses

2020-05-11 Thread David G. Johnston
e table constraint (aside from an artificial primary key). Then, if you can define a problem where you feel having a unique table constraint over the field is the correct solution - especially given the fact that you can have missing data in the relevant fields - you should post the problem and take suggestions on ways to solve it. David J.

Re: Is there a significant difference in Memory settings between 9.5 and 12

2020-05-11 Thread David G. Johnston
on 9.6, 10, and 11 to see if it is indeed new to 12 or at least appears on other versions? David J.

Re: Is there a significant difference in Memory settings between 9.5 and 12.

2020-05-11 Thread David G. Johnston
uation and try v12 David J.

Re: Is there a significant difference in Memory settings between 9.5 and 12

2020-05-11 Thread David G. Johnston
t to remove the pg_upgrade from the equation and try v12 David J.

Re: Is there a significant difference in Memory settings between 9.5 and 12

2020-05-11 Thread David G. Johnston
On Monday, May 11, 2020, David G. Johnston wrote: > Repost, edited subject by mistake... > > On Monday, May 11, 2020, Tory M Blue wrote: >> >> And just to repeat. Same exact hardware, same kernel, nothing more than >> installing the latest postgres12, copying my

Re: Why is it that “aggregate functions are not allowed in FROM clause of their own query level”?

2020-05-13 Thread David G. Johnston
org/message-id/1375925710.17807. > 13.camel%40vanquo.pezone.net Yeah, because usually one just writes your example: Select sum(“v”) from (select 0 as “v”) as t1 group by “v”; > I also posted on DBA.StackExchange > https://dba.stackexchange.com/questions/266988/why-is-it- > that-aggregate-functions-are-not-allowed-in-from-clause-of-their-own > > I did not. David J.

Reuse an existing slot with a new initdb

2020-05-13 Thread David G. Johnston
database they must use a physical backup of the original database as a starting point. To use a logically restored database target would require logical replication. David J.

Re: Bug on version 12 ?

2020-05-15 Thread David G. Johnston
On Fri, May 15, 2020 at 8:27 AM Michael Lewis wrote: > Just wonder, have you compared these on the two servers? > > select * from pg_settings where name = 'DateStyle'; > The OP is using to_timestamp, the DateStyle setting is immaterial. David J.

Re: Bug on version 12 ?

2020-05-15 Thread David G. Johnston
match space template markers with non-space input, skipping the template position altogether without moving along the input string. You will want to change your template to use "T" which more closely matches the input data anwyay. Order you can, and probably should, just stop using to_timestamp and do ("JS->>'mydate)::timestamptz (which has the added benefit of keeping the timezone information). David J.

Re: schema agnostic functions in language sql

2020-05-15 Thread David G. Johnston
y to its parse result earlier. For pl/pgsql none of that happens until the function is called. Because of this pl/pgsql allows for ambiguous sql text to exist and be concretely resolved during execution while SQL does not. David J.

Re: schema agnostic functions in language sql

2020-05-16 Thread David G. Johnston
test schema in the search_path. David J.

Re: Suggestion on index creation for TEXT data field

2020-05-21 Thread David G. Johnston
t. "TEXT" is not a useful answer. If the raw data is too large no index is going to be "best" - as the hint suggests you either need to drop the idea of indexing the column altogether or apply some function to the raw data and then index the result. David J.

Re: Suggestion on index creation for TEXT data field

2020-05-21 Thread David G. Johnston
On Thu, May 21, 2020 at 7:45 AM postgann2020 s wrote: > >And what type of data exactly are we talking about. ==> Column is > stroing GIS data. > GIS data isn't really TEXT and isn't a core datatype of PostgreSQL so this is maybe better posted to the PostGIS community directly... David J.

Re: Should I use JSON?

2020-05-21 Thread David G. Johnston
;t have any other place where that gets saved I would save it to a table first then convert it to the final structured tables. My current setup is using "jq" to perform an intermediate transform of the source json to table-specific files and then using psql and jsonb_to_record insert the

Re: Query returns no rows in pg_basebackup cluster

2020-05-21 Thread David G. Johnston
or a > 'native' Windows instance. Just trying to get confirmation. > Nothing in the OP's text suggests a different server is involved - rather same server but LIKE vs equals. The LIKE query probably doesn't use an index and thus finds the relevant data via sequential scan and equality checks on each record. David J.

Re: Query returns no rows in pg_basebackup cluster

2020-05-21 Thread David G. Johnston
o be a false negative - assume something will break or simply give incorrect results. David J.

Re: Suggestion to improve query performance of data validation in proc.

2020-05-22 Thread David G. Johnston
help us to > improve the performance of the query? > I have no idea what your are trying to get at here. You should try providing SQL that actually runs. Though at first glance it seems quite probable your are doing useless work anyway. David J.

Re: Suggestion to improve query performance of data validation in proc.

2020-05-22 Thread David G. Johnston
e suggest is there any other ways to validate this kind of queries > which will improve the overall performance. > Abandon procedural logic and embrace the declarative set oriented nature of SQL. David J.

Re: Query to get name a data type of a view

2020-05-22 Thread David G. Johnston
nstead of the SQL standard information_schema view. The later doesn’t provide detail of PostgreSQL-specific features by definition. David J.

Re: How to get the OID of a view

2020-05-22 Thread David G. Johnston
don't provide you what you need you need to fall-back to the system tables listed in [2]. [1] https://www.postgresql.org/docs/12/views-overview.html [2] https://www.postgresql.org/docs/12/catalogs-overview.html David J.

Re: query, probably needs window functions

2020-05-22 Thread David G. Johnston
gt; how. > > If a left join doesn’t give you the answer you want you should probably provide exact input and output data that you are working with/toward. David J.

Re: query, probably needs window functions

2020-05-22 Thread David G. Johnston
. You might also consider just outputting one row per person and output the related phone numbers using string_agg(phone.number, E'\n') David J.

Re: Query returns no rows in pg_basebackup cluster

2020-05-24 Thread David G. Johnston
this? I would expect that you could store the offline files anywhere. As long as the architecture your original server is on and the one you are restoring to are the same the restored server should work. They are just bytes until a server interprets them, no? David J.

Re: Query returns no rows in pg_basebackup cluster

2020-05-24 Thread David G. Johnston
needed > 2. Hot standby: User databases in both clusters contain same data. > > Why are you spending so much effort on this Window/Linux hybrid setup? Get yourself another Linux server and setup physical replication. It sounds like it will exactly meet your requirements and you will waste more time and money working out alternatives than the server would cost. David J.

Re: GPG signing

2020-05-26 Thread David G. Johnston
se proper. i.e., store previously signed data into a normal text or bytea field. That said there is: https://www.postgresql.org/docs/12/pgcrypto.html#id-1.11.7.34.7 David J.

Re: suggestion the process to sync the data from PROD DB to Staging environment

2020-05-27 Thread David G. Johnston
ork in your specific situation is impossible to say since you provide zero information about your environment. David J.

Re: suggestion the process to sync the data from PROD DB to Staging environment

2020-05-27 Thread David G. Johnston
On Wed, May 27, 2020 at 9:31 AM postgann2020 s wrote: > Thanks, David, > > Please find the environment details. > > Environment: > PROD: > OS: RHEL 7.1 > Postgres: 9.5.15 > > Staging: > OS: RHEL 7.1 > Postgres: 9.5.15 > Ok...not particularly helpful thou

Re: SELECT query results are different depending on whether table statistics are available.

2020-05-27 Thread David G. Johnston
lts are always the same regardless of whether the table has been > ANALYZED yet. > > Could anyone share knowledge about why this is happening? > A likely scenario is you are missing an ORDER BY in a location where you are depending on deterministic row ordering and its changing out from underneath you. David J.

Re: problem with self built postgres 9.0.9

2020-05-29 Thread David G. Johnston
re tested it is more likely they were tested against 9.0.23 as it is years more current. David J.

Re: When to use PARTITION BY HASH?

2020-06-02 Thread David G. Johnston
in order to combine multiple inputs onto the same table. David J.

Re: A parsing question

2020-06-03 Thread David G. Johnston
% ^ & | ` ? For example, @- is an allowed operator name, but *- is not. This restriction allows PostgreSQL to parse SQL-compliant queries without requiring spaces between tokens. David J.

Re: Can we get SQL Server-like cross database queries

2020-06-04 Thread David G. Johnston
qs for this feature also have other concrete benefits that are worth working toward, and in the end the sum of those makes cross-database queries a relatively simple matter, I would entertain putting in the last 10% of effort to become standard compliant. David J.

Re: gdal, proj and other postgis dependencies missing in postgres repos

2020-06-07 Thread David G. Johnston
nk you. >> > https://yum.postgresql.org/news-newreporpmsreleased.php David J.

Re: checking existence of a table before updating its SERIAL

2020-06-08 Thread David G. Johnston
On Monday, June 8, 2020, Matthias Apitz wrote: > > Can some kind soul help me with doing a test for the existence of the > table to avoid the error message about non existing relation? > https://www.postgresql.org/docs/12/catalogs-overview.html David J.

Re: Is it possible to use keywords (date units) in a function definition?

2020-06-08 Thread David G. Johnston
On Mon, Jun 8, 2020 at 2:57 PM Alistair Johnson wrote: > > RETURN EXTRACT(datepart FROM end - start); > Any ideas? Is this even possible? > Use the "date_part" function. David J.

Re: Is it possible to use keywords (date units) in a function definition?

2020-06-08 Thread David G. Johnston
R as a custom type value without single quotes surrounding it If that is the question the answer is no. The only type literals that can be written without single quotes are numbers. The parsing of SQL can handle some standard mandated non-quoted constants but they are basically keywords, not values. David J.

Re: Is it possible to use keywords (date units) in a function definition?

2020-06-08 Thread David G. Johnston
On Mon, Jun 8, 2020 at 5:06 PM Martin Gainty wrote: > CREATE OR REPLACE FUNCTION DATETIME_DIFF(end TIMESTAMP(3), start > TIMESTAMP(3), datepart UNIT) RETURNS DOUBLE PRECISION AS $$ > Duplicate email from account (same sender) - already answered on the original/correct thread. David J.

Re: suggestion: psql configs in .config

2020-06-11 Thread David G. Johnston
bpq consults environment variables to allow for user customization. David J.

Re: Returning SELECTed rows immediately instead of all at the end?

2020-06-12 Thread David G. Johnston
om a shell script or > SQL function in order to see the output as each index is checked? > You could wrap the function call in a custom plpgsql function (or just do a plpgsql loop) and side channel output via notice but i’d probably just do a shell script wrapper absent any other constraint. David J.

<    5   6   7   8   9   10   11   12   13   14   >