Re: control over database files

2018-07-17 Thread David G. Johnston
sands of identical tables...) can either reduce the need for them or make setting them up considerably easier, respectively. IOW, starting with a higher level use case will produce more useful responses. David J.

Re: Postgres function with output parameters and resultset

2018-07-20 Thread David G. Johnston
over-engineering. If you really want the count you'd need to add it to the table but the client can count the records in the table easily enough. Errors can be done separately via RAISE and likewise let the client deal with that as usual. Otherwise I've found JSON to be useful for non-tabular results. David J.

Re: User documentation vs Official Docs

2018-07-20 Thread David G. Johnston
can find resources and then point people to those that exist today next time questions come up (or have them asked on -general). David J.

Re: Restore relhaspkey in PostgreSQL Version 11 Beta

2018-07-30 Thread David G. Johnston
iven that no one is willing to make the field work as named) to be the correct one (by a not-wide margin). David J.

Re: Question on postgresql.conf

2018-07-30 Thread David G. Johnston
On Monday, July 30, 2018, Alvaro Aguayo Garcia-Rada wrote: > > As far as I know, it's not currently possible. > That would be incorrect, you just need to change server startup commands. https://www.postgresql.org/docs/10/static/runtime-config-file-locations.html David J.

Re: List user who have access to schema

2018-08-02 Thread David G. Johnston
On Thursday, August 2, 2018, Suresh Raja wrote: > yes ... how can i pass variable * to the function has_schema_privilege(*, > 'schema-of-interest', 'usage'); > You cannot...you must execute the function once for every user, hence the original query's from clause. David J.

Re: How to revoke privileged from PostgreSQL's superuser

2018-08-06 Thread David G. Johnston
till access the data but would be challenged to make sense of it, Usually DBAs are tasked with backups which requires read access to all relevant data. David J.

Re: Instead trigger on a view to update base tables ?

2018-08-07 Thread David G. Johnston
On Tue, Aug 7, 2018 at 12:09 PM, Day, David wrote: > EXECUTE format(' UPDATE admin.user SET (%I) = ( SELECT %I FROM $1 ) WHERE > id = $2)', USER_SETTING, USER_SETTING ) > USING NEW, NEW.id; > > When this executes my exception handler generates "

Re: check_function_bodies not doing much

2018-08-07 Thread David G. Johnston
e in the languages themselves) to mention what the check covers for each of them. At least distinguishing between syntax and semantics for each. David J.

Re: Postgres - search for value throughout many tables?

2018-08-08 Thread David G. Johnston
provides that ability though you possibly could work up something using dynamic sql. David J.

Re: Copying data from a CSV file into a table dynamically

2018-08-14 Thread David G. Johnston
rsion you care about to learn it's limits. David J.

Re: What is the use case for UNLOGGED tables

2018-08-14 Thread David G. Johnston
d tables but I want to manipulate tables while transforming from the original input. David J.

Re: PostgreSQL System Views or Dictionary Tables

2018-08-16 Thread David G. Johnston
.5 and pgAdmin 4 version > 3.2 . > https://www.postgresql.org/docs/10/static/index.html Section VII is internals - the "structural dba tables" are termed "System Catalogs" in PostgreSQL. David J.

Re: Can Pg somehow recognize/honor linux groups to control user access ?

2018-08-22 Thread David G. Johnston
ured to accommodate this use case as well as many other configurations people may think up. https://www.postgresql.org/docs/10/static/auth-methods.html#AUTH-PAM David J.

Re: Can Pg somehow recognize/honor linux groups to control user access ?

2018-08-22 Thread David G. Johnston
" can be established between the two in pg_hba.conf. David J.

Re: Will there ever be support for Row Level Security on Materialized Views?

2018-08-27 Thread David G. Johnston
might or might not be planning/doing in this area before the heat death of the universe (a reasonably close approximation of "ever")". Since most things are theoretically possible a flat out - "no that will never happen is unlikely". David J.

Re: using a plpgsql function argument as a table column.

2018-08-28 Thread David G. Johnston
On Tuesday, August 28, 2018, Shaun Savage wrote: > I want to dynamically return a column from a function. > Variable object identifiers requires executing dynamic SQL. See: https://www.postgresql.org/docs/10/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN David J.

Re: using a plpgsql function argument as a table column.

2018-08-28 Thread David G. Johnston
r design is unahappy - against to ideas of relations > databases. So any native tools will be impossible. > +1 I don’t know for sure that what is desired is not possible but only because the specification and model are more than I wish to untangle at the moment... David J.

Re: Issue with psqlrc with command line.

2018-08-29 Thread David G. Johnston
a single backslash command.” https://www.postgresql.org/docs/10/static/app-psql.html David J.

Re: Issue with psqlrc with command line.

2018-08-29 Thread David G. Johnston
On Wednesday, August 29, 2018, saurabh shelar wrote: > Hi David, > > Thank you for the swift response. > > However, could you please confirm if the below scenario is expected. > > - included the alias in the file. > - And passed the file with psql and it worked.

Re: Issue with psqlrc with command line.

2018-08-29 Thread David G. Johnston
On Wed, Aug 29, 2018 at 8:31 AM, saurabh shelar wrote: > Hi David, > > Thank you for the help. > > I was just got confused with the below line mentioned in the document. > However, it seems it is still the same behaviour *(i.e --no-psqlrc)*. > > *"Before PostgreSQL

Re: Executing a Function with an INSERT INTO command fails

2018-08-29 Thread David G. Johnston
at the next time you run your calling query it indeed fails. I'm suspecting that the code you are iterating over is not the same code that is being executed (search_path dynamics probably). That or you are looking in from another session without committing the first one. David J.

Re: Executing a Function with an INSERT INTO command fails

2018-08-29 Thread David G. Johnston
atic/plpgsql-errors-and-messages.html#PLPGSQL-STATEMENTS-RAISE I was going for a conceptual communication, not syntax. Though if you indeed get a syntax error then that precludes the "wrong object" theory. David J.

Re: Ways to deal with large amount of columns;

2018-08-30 Thread David G. Johnston
esn't have so many columns. Otherwise generating dynamic SQL via the for,at function and loops and such is your best bet. Can be down in pl/pgsql or in your preferred programming language. Psql variables can maybe be useful too. David J.

Re: searching a value in a variable/field in all tables in a schema

2018-08-30 Thread David G. Johnston
AS loc, fld FROM schema.tbl2 WHERE fld = 'value' ...] David J.

Re: Select rows when all all ids of its children records matches

2018-09-12 Thread David G. Johnston
On Wednesday, September 12, 2018, Arup Rakshit wrote: > IN is OR, I want the AND logic. Select posts which has tag 1, 2 and 3 ( > tag ids ) > Build arrays and then use the “contains” operator. David J.

Re: [External] RE: Estimate time without running the query

2018-09-13 Thread David G. Johnston
uspect) such as locks, caching, physical data locality. It seems more useful to log actual execution times and look for trends. If you are writing a query odds are it needs to be run regardless of how efficient it may be - or used in a relative comparison to an alternate query. David J.

Re: Behaviour when autovacuum is canceled

2018-09-13 Thread David G. Johnston
> >From the docs: "VACUUM cannot be executed inside a transaction block." As it is non-transactional any work it performs is live immediately and irrevocably as it occurs. David J.

Re: Code of Conduct plan

2018-09-14 Thread David G. Johnston
entence should be, IMO, adjusted to loosen the "where" while tightening the "who". Beyond that I don't object to writing out explicitly the option to consider "external" activity - I doubt it will matter in practice and if the situation is severe enough that it does then core could do what they want anyway and deal with the fallout whether a CoC exists or whatever its contents. I do not believe that, for the typical community member with a low profile, this will ever come into play. David J.

Re: Why is JSONB field automatically cast as TEXT?

2018-09-17 Thread David G. Johnston
erything must be typed. It is not casting the first or intermediate jsonb results to text. The final output is text because of the ->> operator. :: binds more tightly than the other operators. Jsonb->('somedata'::text) David J.

Re: [GENERAL] optimising the pl/pgsql function

2018-09-18 Thread David G. Johnston
On Tue, Sep 18, 2018 at 11:37 AM, VENKTESH GUTTEDAR < venkteshgutte...@gmail.com> wrote: > Can we replace the for loop with something else? > A query probably - depending on what the function does and, in particular, whether dynamic SQL is required. David J.

Re: How can I get and handle the status of sql statements that run in plpgsql ?

2018-10-03 Thread David G. Johnston
On Wed, Oct 3, 2018 at 9:25 AM, David Gauthier wrote: > Is that how you detect if nothing was updated > https://www.postgresql.org/docs/10/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-DIAGNOSTICS Given your concerns and examples you might also want to look into serializable isolati

Re: pg_pass and pg_service

2018-10-04 Thread David G. Johnston
On Thursday, October 4, 2018, Tim Uckun wrote: > can I refer to a pg_service entry in the pgpass file? It seems silly to > repeat all the information in the pgpass just to add the password. > No > Alternatively can I put the user password in the pg_service file? > Yes David J.

Re: SELECT UNION into a text[]

2018-10-09 Thread David G. Johnston
WHERE added > TO_TIMESTAMP(1539100913); > > SELECT array_agg(words) FROM ( SELECT hashed FROM words_nouns UNION ALL SELECT hashed FROM words_verbs ) AS src David J.

Re: Privilege mess?

2018-10-09 Thread David G. Johnston
ecurity. But yes it is generally sufficient enough to simply allow usage on scheme without much thought while ensuring contained objects are sufficiently secured. David J.

Re: Regarding varchar max length in postgres

2018-10-15 Thread David G. Johnston
n (cell) - you will still encounter a physical limit to the number of bytes able to be stored in a single cell when using text. David J.

Re: Saving view turns SELECT * into field list

2018-10-15 Thread David G. Johnston
Yes, deeply nesting views is a maintenance concern. It works this way so the view remains stable (there may be others, the reasoning no longer really matters...). If you really want dynamic SQL you will need to use a function. David J.

xpath differences between postgres 11.4 and 10.3

2019-07-06 Thread David G. Johnston
ly, use // to look for the attribute anywhere David J.

Re: pg_dump and search_path

2019-07-09 Thread David G. Johnston
r. But, yes, objects saved to the database should usually have schema qualifications (which gets a bit messy with custom operators). search_path reliance should probably be reserved to interactive use or at worse client supplied queries. David J.

Re: pg_dump and search_path

2019-07-09 Thread David G. Johnston
On Tue, Jul 9, 2019 at 8:48 AM Igal @ Lucee.org wrote: > David, > > On 7/9/2019 7:49 AM, David G. Johnston wrote: > > On Tue, Jul 9, 2019 at 7:41 AM Igal @ Lucee.org wrote: > >> search_path is not set int he config, but rather with ALTER DATABASE SET >> search_p

Re: how to return rows of data via function written by language C strict

2019-07-09 Thread David G. Johnston
> So, due to the lack of examples in general and the sparse documentation > about it, any help will be appreciate. > As Ian noted, contrib is usually the recommended source for up-to-date coding examples. David J.

Re: Why no CREATE TEMP MATERIALIZED VIEW ?

2019-07-16 Thread David G. Johnston
ed in people deciding (or defaulting) to not spend any effort in that area. Incremental maintenance and refresh seem considerably less useful when only the current session can see the table. Temp views and temp tables seem to provide sufficient options in the session lifetime space. David J.

Re: Change in db size

2019-07-17 Thread David G. Johnston
decide what amount of internal data validation you can live with. It also depends on whether you have expected numbers based upon the data being restored. David J.

Re: Looking for Postgres upgrade Metrix

2019-07-17 Thread David G. Johnston
mmended in cross-version cases, as it can prevent problems arising from varying reserved-word lists in different PostgreSQL versions. David J.

Re: Looking for Postgres upgrade Metrix

2019-07-17 Thread David G. Johnston
On Wed, Jul 17, 2019 at 11:39 AM Perumal Raj wrote: > Thanks Adrian, David, > > Basically , i want to upgrade few 9.X/8.X version DBs to some stable > version ( 10.X / 11.X ), At the same time with less down time. > So want to understand whether direct upgrade possible or no

Re: rename table between schema with one command

2019-07-24 Thread David G. Johnston
sql command that can do those things and the syntax does not provide a way to combine the two into a single executable command. Out of curosity, why do you ask? David J.

Re: Which version to upgrade upto

2019-07-31 Thread David G. Johnston
ition in the version number became the patch release version so both 11.2 and 11.4 are the same major version (v11) and 11.2 is guaranteed to be more buggy than 11.4. If you wish to be cautious then you should upgrade to the v10 series which is presently at 10.9 David J.

Re: DDL and DML in a transaction

2019-07-31 Thread David G. Johnston
you expect the drop to succeed. Would it have less locking than simply altering the column? > I doubt anything will improve upon simply altering the column. You have to perform a full table rewrite in either case which is going to be the main resource consumer. David J.

Re: Why must AUTOCOMMIT be ON to do txn control in plpgsql procedure?

2019-08-07 Thread David G. Johnston
On Wed, Aug 7, 2019 at 12:18 PM Luca Ferrari wrote: > On Wed, Aug 7, 2019 at 8:28 PM Bryn Llewellyn wrote: > > > B.t.w., I noticed that “set transaction isolation level serializable” > must be the very first statement after “rollback” (or “commit”). Even an > invocation of txid_current() after t

Re: How to check if a field exists in NEW in trigger

2019-08-07 Thread David G. Johnston
argument (has_email_field boolean) and when attaching the function to the trigger attach it with either true/false depending on whether the target table has an email field. David J.

Re: Probably a newbie question

2019-08-10 Thread David G. Johnston
On Saturday, August 10, 2019, stan wrote: > Sorry, I got the list address wrong the first time, and when I corected it, > I forget to fix the subject line. > > This subject line isn’t materially better...subjects should reflect the technical content of the message, not its sender. David J.

Re: A GROUP BY question

2019-08-13 Thread David G. Johnston
meaningful way. > Sure you can, at least generally, with Window Functions/Expressions (i.e., OVER) David J.

Re: A 3 table join question

2019-08-16 Thread David G. Johnston
oin against. In any case to directly solve this in the full join form you probably want to do something like: SELECT ... FROM tbl1 FULL JOIN (tbl2 AS tbl2alias (proj2_id) FULL JOIN tbl3 AS tbl3alias (proj3_id) ON proj2_id = proj3_id) AS tbl23 ON (tbl23.proj2_id = tbl1.proj_id OR tbl23.proj3_id = tbl1

Re: Importing from CSV, auto creating table?

2019-08-21 Thread David G. Johnston
e. Am I missing > something? > > Nope. You need to create the table separately - or find a tool that will do that creation for you. David J.

Re: Importing from CSV, auto creating table?

2019-08-21 Thread David G. Johnston
>> use the header from a CSV file to define a new table. Am I missing >> something? >> > > Data types. Sure, you've got column names from the header line, but what > types do you assign them? Text. I’m gonna post-process anyway, casting to better types isn’t a problem. David J.

Re:

2019-08-28 Thread David G. Johnston
ing a scenario where running reindex or vacuum arbitrarily at session end would be a useful thing. David J.

Re: Problems with using function input paramaters

2019-08-31 Thread David G. Johnston
single quotes) is always treated as literal content. David J.

Re: Receivgin error while altering the table column datatype

2019-09-25 Thread David G. Johnston
er"* > > Do I need to drop the trigger and alter the table column to modify the > datatype of the columns. Am I correct? > Seems like a reasonable course of action, and simple enough to just experiment with on a test relation. > or is there any other way to resolve it. > Doubtful David J.

Re: Arrays and ANY problem

2019-09-25 Thread David G. Johnston
On Wed, Sep 25, 2019 at 3:08 PM David Salisbury wrote: > Thanks, > > Unfortunately I believe I need to include a postgres module to get the > "<@" operator, which I have no power to do. This is what I get with that > operator.. > > select name from table_n

Re: jsonb_set() strictness considered harmful to data

2019-10-18 Thread David G. Johnston
ignore and return the original object" or "add the key with a json null scalar value" is debatable but either is considerably more useful than returning SQL NULL. David J.

Re: jsonb_set() strictness considered harmful to data

2019-10-18 Thread David G. Johnston
n the rare case it is needed. Current behavior is unsafe with minimal or no redeeming qualities. Change it so passing in null raises an exception and make the user decide their own behavior if we don’t want to choose one for them. David J.

Re: jsonb_set() strictness considered harmful to data

2019-10-19 Thread David G. Johnston
subjective - with no obvious reasonable default, and I agree that "return a NULL" while possible consistent is probably the least useful behavior that could have been chosen. We should never have allowed an SQL NULL to be an acceptable argument in the first place, and can reasonably safely and effectively prevent it going forward. Then people will have to explicitly code what they want to do if their data and queries present this invalid unknown data to the function. David J.

Re: jsonb_set() strictness considered harmful to data

2019-10-20 Thread David G. Johnston
robably the same thing - though I'd accept having the input json being null result in the output json being null as well. David J.

Re: jsonb_set() strictness considered harmful to data

2019-10-21 Thread David G. Johnston
or to the caller using normal mechanisms for "SQLException" propogation. David J.

Re: Lookup Primary Key of Foreign Server's Table

2019-10-22 Thread David G. Johnston
u added the schema prefix "sidecar_link" to the table name when you issued \d above. > > > > > > > *=> \det List of foreign tables Schema | Table | Server > +---+(0 rows)* > David J.

Re: jsonb_set() strictness considered harmful to data

2019-10-22 Thread David G. Johnston
ry about changing (though moving to exception is safe) but a policy choice now could at least pave the way to avoid this situation when the next new datatype is implemented. In many functions we do provoke exceptions when known invalid input is provided - supplying a function with a primary/important argument being undefined should fall into the same "malformed" category of problematic input. David J.

Re: jsonb_set() strictness considered harmful to data

2019-10-23 Thread David G. Johnston
On Wed, Oct 23, 2019 at 4:42 AM Laurenz Albe wrote: > David G. Johnston wrote: > > Now if only the vast majority of users could have and keep this level of > understanding > > in mind while writing complex queries so that they remember to always > add protections > > t

Re: Lookup Primary Key of Foreign Server's Table

2019-10-23 Thread David G. Johnston
gt; I don't see a primary key defined, so I'm presuming I need to issue an ADD > CONSTRAINT command against the foreign table to reflect what is actually > true in the foreign table? Is that correct? > The documentation says doing what you suggest won't work... David J.

Re: ERROR: there is no unique constraint matching given keys for referenced table "audit_p"

2019-11-18 Thread David G. Johnston
clear, the new feature has some rough edges (limitations) that you are hitting with your desired model. David J.

Re: using replace function

2019-11-28 Thread David G. Johnston
shark','blue','blue fish'); > > replace > > > > blue shark > > (1 row) > > > > Thanks a lot > > > > Antonio Olinto > > does this help? > select replace (a.col, ‘value’, ’new value’) where a.col = ‘value’; > > I’d probably do something like: Select case when a.col = ‘value’ then ‘new value’ else a.col end from a; I suspect adding where a.col = ‘value’ isn’t viable. If it is then: Select ‘new value’ from a where a.col = ‘value’; David J.

Re: Counting booleans in GROUP BY sections

2019-11-29 Thread David G. Johnston
y use WINDOW functions to accomplish your goal - count(...) OVER (PARTITION BY )) David J.

Re: Not my day :-( Another syntax error

2019-12-26 Thread David G. Johnston
The "outer" one doesn't have a FROM clause and so doesn't have access to columns. The "outer" SELECT project_cost_category_key is thus invalid. David J.

Re: How to reset a server error '25P02 in_failed_sql_transaction'

2019-12-31 Thread David G. Johnston
On Tuesday, December 31, 2019, Ron wrote: > > But how do you issue a ROLLBACK to a different pid? > You cannot. At that point you need to start from scratch. pg_terminate_backend(*pid int*) And let the problematic app deal with losing its database connection however it will. David J.

Re: Multiple Aggregations Order

2020-01-14 Thread David G. Johnston
On Tuesday, January 14, 2020, João Haas wrote: > > SELECT tb.*, array_agg(conn.child_id), array_agg(conn.kind) > > Create a custom type (using row(...) might work...?) with the relevant fields and “...array_agg((child_id, kind)::custom_type order by ...”? David J.

Re: OID out of range

2020-01-15 Thread David G. Johnston
On Wed, Jan 15, 2020 at 11:36 AM bhargav kamineni wrote: > Any workaround to make it work ? > Convert both to text and join on that? Curious choice making relid numeric... David J.

Re: OID out of range

2020-01-15 Thread David G. Johnston
; and > c.relnamespace::regnamespace::text='rpx_reporting_stage' and > u.captured_dt::date=current_date - interval '1 days' > ; > > > ERROR: OID out of range > >> >> Yeah, the join isn't the problem, the error is casting to OID, not from... Pretty sure your problem is: pg_relation_size(u.table_size) David J.

Re: pg_prepared_statements

2020-01-20 Thread David G. Johnston
cally it is not a "log" in the transaction sense and its only shows current session data. David J.

Re: pg_prepared_statements

2020-01-20 Thread David G. Johnston
https://www.postgresql.org/docs/12/runtime-config-resource.html#GUC-MAX-PREPARED-TRANSACTIONS David J.

Re: SQL Query Syntax help

2020-01-22 Thread David G. Johnston
gt; After applying the logic i need to take this data into the table. > > can you please help me how to write the syntax in this case. > Cast everything to text? https://www.postgresql.org/docs/12/sql-expressions.html#SQL-SYNTAX-TYPE-CASTS David J.

Re: combination join against multiple tables

2020-01-31 Thread David G. Johnston
maybe as part,of a lateral join, not sure without experimentation. Otherwise you can add “row_number” to “b” and “c” and then left join on (a, row_number). David J.

Re: Restrict connection from pgadmin.

2020-02-03 Thread David G. Johnston
along all of the validation information and so can make up values for any parameters you might wish to check so that they look like, i.e., your application as far as the authentication code is concerned. David J.

Re: The best way to solve a problem

2020-02-04 Thread David G. Johnston
e it will be large enough to matter. You can always make changes later as new requirements are added or constraints such as size become more important. David J.

Re: POLL: Adding transaction status to default psql prompt

2020-02-05 Thread David G. Johnston
On Wed, Feb 5, 2020 at 7:55 PM Vik Fearing wrote: > Please answer +1 if you want or don't mind seeing transaction status by > default in psql or -1 if you would prefer to keep the current default. > +1

Re: Can we have multiple tablespaces with in a database.

2020-02-20 Thread David G. Johnston
gle physical table. To the benefit of those who don't use the other product you may wish to say exactly what you want to do instead of comparing it to something that many people likely have never used. David J.

Re: How to get the name of the table taht fired a triigger?

2020-02-21 Thread David G. Johnston
On Friday, February 21, 2020, stan wrote: > > How can I get the name of the table that fired a trigger, in the function > called by that trigger? > Language specific. Read the language docs. For pl/pgsql: https://www.postgresql.org/docs/12/plpgsql-trigger.html David J.

Re: table name "unnest" specified more than once

2020-02-27 Thread David G. Johnston
;) > ]) > > Here, c is a function that constructs a card type. Card is a ROW(varchar, > varchar). > > So: how do I cross-join three identical arrays of my card type? > Something like: Select f1.a, f2.b >From (select * from unnest(arr)) as f1 (a) Cross join (select * From unnest(arr)) as f2 (b) Etc...Maybe with parentheses... There may be a more succinct way to write this but going verbose until it works minimizes the amount of syntax you need to deal with. Though I personally encourage writing intentional cross join (really, all joins) using join syntax instead of comma-separated from items. David J.

Re: Detecting which columns a query will modify in a function called by a trigger

2020-03-02 Thread David G. Johnston
constraints to the table to describe and enforce the inter-field relationships that are present. David J.

Re: Detecting which columns a query will modify in a function called by a trigger

2020-03-03 Thread David G. Johnston
ommendations to start there and avoid rules if at all possible. David J.

Re: Detecting which columns a query will modify in a function called by a trigger

2020-03-03 Thread David G. Johnston
On Tue, Mar 3, 2020 at 4:11 PM Adrian Klaver wrote: > On 3/3/20 3:06 PM, David G. Johnston wrote: > > On Tue, Mar 3, 2020 at 3:48 PM Adrian Klaver > <mailto:adrian.kla...@aklaver.com>> wrote: > > > > The link was for automatically updateable views. If you

Re: Suggestion to reduce COPY command output to csv file

2020-03-04 Thread David G. Johnston
e.? > Not sure on an additive suggestion but you probably can get considerable mileage by removing Excel from the equation and bring the external data into PostgreSQL and use joins (i.e., SQL's version of VLOOKUP). David J.

Re: Advice request : simultaneous function/data updates on many databases

2020-03-04 Thread David G. Johnston
oose different names for the new stuff then remove the old stuff separately. David J.

Re: Advice request : simultaneous function/data updates on many databases

2020-03-04 Thread David G. Johnston
USING liberally. CREATE FUNCTION perform_update()... AS $outer$ BEGIN drop_sql := $inner$ DROP FUNCTION ...; $inner$ EXECUTE drop_sql; END; $outer$; David J.

Re: Advice request : simultaneous function/data updates on many databases

2020-03-04 Thread David G. Johnston
On Wed, Mar 4, 2020 at 3:55 PM David G. Johnston wrote: > On Wed, Mar 4, 2020 at 3:48 PM Rory Campbell-Lange < > r...@campbell-lange.net> wrote: > >> Any thoughts on how to wrap pl/pgsql function dropping and recreation code >> within a wrapper pl/pgsql function? &

Re: Advice request : simultaneous function/data updates on many databases

2020-03-04 Thread David G. Johnston
ld and new software to continue working normally. The second commit then removes the functionality the older software versions are using - after they've been phased out. David J.

Re: Determining the type of an obkect in plperl

2020-03-04 Thread David G. Johnston
column. Then measure performance and decide whether a generic routine is performant enough. If not you might try creating custom function dynamically using the catalogs as input. David J.

Re: `DROP DATABASE RESTRICT` ?

2020-03-04 Thread David G. Johnston
t. It also likely has at least an empty public schema... David J.

Re: Performance Problem

2020-03-04 Thread David G. Johnston
ome suggestions for how to request help that is actionable: https://wiki.postgresql.org/wiki/Slow_Query_Questions Start specific and then generalize. David J.

Re: A question about the number of times a trigger will fire

2020-03-05 Thread David G. Johnston
. > > What am I missing, here? > > OLD and/or NEW? https://www.postgresql.org/docs/12/plpgsql-trigger.html#PLPGSQL-DML-TRIGGER David J.

Re: format return of "age" to hh:mm

2020-03-05 Thread David G. Johnston
On Thu, Mar 5, 2020 at 8:50 AM David Gauthier wrote: > Hi: > > How does one reformat the output of the "age" function to always be in > terms of hours:mins. > > > Custom function. Use justify_hours(interval) to normalize the input in terms of days Use extract(

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.

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