Re: Need help with trigger

2021-01-23 Thread Melvin Davidson
; I'm sorry, I don't understand something. You mean to do pure INSERT ON > > CONFLICT DO or to modify the trigger ? > > No I meant that in the external program you use to fetch the data from > the other table and reorganize the fields. Do your test there and do > eit

Re: Date created for tables

2019-12-25 Thread Melvin Davidson
thing that you use every day, but when it *is* > useful, it's *very* useful. > > Don’t both of those examples hi-light flaws in the release procedures? > > > And bug highlight flaws in the development process. We're human, after > all. > > -- > Angular momentum makes the world go 'round. > -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: Date created for tables

2019-12-23 Thread Melvin Davidson
update ran. > > Likewise, modification time is when we last ran an ALTER command ran, not > when VACUUM ran (that's tracked elsewhere) or DML ran. > > That's all. > > -- > Angular momentum makes the world go 'round. > -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: Schema Copy

2019-12-05 Thread Melvin Davidson
s, >>> newschema.functios etc... >>> >>> This does not move data >>> >>> On Thu, Dec 5, 2019 at 5:07 AM Sonam Sharma >>> wrote: >>> >>>> Can someone please help in schema copy in same database ? >>>> >>>>

Re: SOLVED Re: Recovering disk space

2019-10-10 Thread Melvin Davidson
t; > -- Benjamin Franklin > > > > > > -- > "They that would give up essential liberty for temporary safety deserve > neither liberty nor safety." > -- Benjamin Franklin > > > -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: problems importing from csv

2019-09-13 Thread Melvin Davidson
y that would give up essential liberty for temporary safety deserve > neither liberty nor safety." > -- Benjamin Franklin > > > -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: How to determine what is preventing deleting a rule

2019-08-17 Thread Melvin Davidson
s depend on it > DETAIL: 1 object in database d2 > d1=# \c d2 > You are now connected to database "d2" as user "postgres". > d2=# drop user joe; > ERROR: role "joe" cannot be dropped because some objects depend on it > DETAIL: owner of table tt &

Re: Probably a newbie question

2019-08-10 Thread Melvin Davidson
-- > Angular momentum makes the world go ‘round. > > > You might get away with adding > group by vendor_key > if it turns out you’re simply getting many copies of vendor key from that > inner select. > Run it alone to see. > > > -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: FW: Undelivered Mail Returned to Sender

2019-08-10 Thread Melvin Davidson
han one row returned by a subquery used as an expression > > Can someone please enlighten me as to the error of my ways? > > > -- > "They that would give up essential liberty for temporary safety deserve > neither liberty nor safety." >

Re: Does pgadmin4 work with postgresql 8.4?

2019-08-05 Thread Melvin Davidson
works:) > > > > > > > > Thanks, > > > ~Ben > > > > > > -- > > Adrian Klaver > > adrian.kla...@aklaver.com <mailto:adrian.kla...@aklaver.com> > > > > > -- > Adrian Klaver > adrian.kla...@aklaver.com > > > -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: Possible Values of Command Tag in PG Log file

2019-07-18 Thread Melvin Davidson
ian.kla...@aklaver.com > > > > This message is intended only for the use of the addressee and may contain > information that is PRIVILEGED AND CONFIDENTIAL. > > If you are not the intended recipient, you are hereby notified that any >

Re: Back Slash \ issue

2019-05-02 Thread Melvin Davidson
ry and confidential and subject to the Tech Mahindra policy > statement, you may review the policy at > http://www.techmahindra.com/Disclaimer.html < > http://www.techmahindra.com/Disclaimer.html> externally > http://tim.techmahindra.com/tim/disclaimer.html < > http://tim.techmahindra.com/tim/disclaimer.html> internally within > TechMahindra. > > > > > > > > > > > > > > -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: Transactions

2019-04-09 Thread Melvin Davidson
hindra.com/Disclaimer.html externally > http://tim.techmahindra.com/tim/disclaimer.html internally within > TechMahindra. > > > ======== > > > > -- > Achilleas Mantzios > IT DEV Lead > IT DEPT > Dynacom Tankers Mgmt > > -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: pg_upgrade --jobs

2019-04-07 Thread Melvin Davidson
ting the schema dump > while in service but possibly not in this scenario. Plan B is to drop a lot > of tables and deal with imports later. > > I take the above to mean that a lot of the tables are cruft, correct? > > > > > I appreciate the help. > > > > > -

Re: Reg: Pg_Ctl command help

2019-04-03 Thread Melvin Davidson
blication of this message without the prior written consent of authorized >> representative of HCL is strictly prohibited. If you have received this >> email in error please delete it and notify the sender immediately. Before >> opening any email and/or attachments, please check them for viruses and >> other defects. >> ----

Re: Copy entire schema A to a different schema B

2019-02-21 Thread Melvin Davidson
respectively. This can also be > done on the pg_dump end. > > > > > Thanks. > > > > Tiff > > > > > >> -- > > >> Adrian Klaver > > >> adrian.kla...@aklaver.com <mailto:adrian.kla...@aklaver.com> > > > > > -- > Adrian Klaver > adrian.kla...@aklaver.com > > -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: Alter table column constraint

2018-12-17 Thread Melvin Davidson
See https://www.postgresql.org/docs/current/tutorial-fk.html On Mon, Dec 17, 2018 at 3:32 PM David G. Johnston < david.g.johns...@gmail.com> wrote: > On Mon, Dec 17, 2018 at 1:20 PM Rich Shepard > wrote: > > > > On Mon, 17 Dec 2018, Melvin Davidson wrote: > > >

Re: Alter table column constraint

2018-12-17 Thread Melvin Davidson
#x27;other))', 'Chemicals') ... ... ('Transportation'); Then you can ALTER TABLE your_table ADD CONSTRAINT FOREIGN KEY (industry) REFERENCES fks_for_tables(fks_valies); On Mon, Dec 17, 2018 at 3:20 PM Rich Shepard wrote: > On Mon, 17 Dec 2018, Melvin Davidson wrote: >

Re: Alter table column constraint

2018-12-17 Thread Melvin Davidson
t of mine is to tell it exactly how it is. *** > PostgreSQL centered full stack support, consulting and development. > Advocate: @amplifypostgres || Learn: https://postgresconf.org > * Unless otherwise stated, opinions are my own. * > > > -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: Code of Conduct plan

2018-09-15 Thread Melvin Davidson
could go out and find a "problem" > and then file a complaint --- but then they'd have to recuse themselves > from dealing with that complaint, so there's an incentive not to. > > regards, tom lane > > -- *Melvin Davidson* *Ma

Re: extracting the sql for a function

2018-08-23 Thread Melvin Davidson
g_get_functiondef('functionname(list of parameters data > types)'::regprocedure); > > If you want to export you may use the -t and -o switches. > > Regards > Charles > > > > -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: Restore relhaspkey in PostgreSQL Version 11 Beta

2018-07-31 Thread Melvin Davidson
is career.I just need a way to do so quietly and painlessly.The truth is absolute and cannot be changed.Perception is not the truth.Flerp!* -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: Restore relhaspkey in PostgreSQL Version 11 Beta

2018-07-30 Thread Melvin Davidson
On Mon, Jul 30, 2018 at 6:21 PM, Andres Freund wrote: > Hi, > > On 2018-07-30 17:21:25 -0400, Melvin Davidson wrote: > > * >it has never been the case that relhaspkey meant that the table > > *currently* has a primary key. * > > > *Hmmm, I guess it's a lot

Re: Restore relhaspkey in PostgreSQL Version 11 Beta

2018-07-30 Thread Melvin Davidson
mary key after vacuum"rather than just dropping a column that has existed from version 7.2.So now I guess the policy is break code instead of fix documention.That meakes sense...NOT!* -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: Restore relhaspkey in PostgreSQL Version 11 Beta

2018-07-30 Thread Melvin Davidson
On Mon, Jul 30, 2018 at 10:31 AM, Tom Lane wrote: > Melvin Davidson writes: > > In the release notes for Version 11 Beta, under changes, I see these > scary > > remarks: > > Remove relhaspkey column from system table pg_class (Peter Eisentraut) > > Applications

Restore relhaspkey in PostgreSQL Version 11 Beta

2018-07-30 Thread Melvin Davidson
nt, not at someone's whim. Adding a column is fine, but dropping columns that breaks code is ridiculous. Please restore that column before the final release! -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: User documentation vs Official Docs

2018-07-20 Thread Melvin Davidson
ant.com/ > PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services > > > This sounds like somebody looking for a solution when they don't yet know what the problem is. +1 -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: User documentation vs Official Docs

2018-07-19 Thread Melvin Davidson
On Thu, Jul 19, 2018 at 8:54 PM, Adrian Klaver wrote: > On 07/19/2018 05:43 PM, Melvin Davidson wrote: > >> >> >> > >> >> > Then again people might use shared, university or library computers >> Would you please be so kind as to inform us which

Re: User documentation vs Official Docs

2018-07-19 Thread Melvin Davidson
On Thu, Jul 19, 2018 at 8:09 PM, Ken Tanzer wrote: > On Thu, Jul 19, 2018 at 11:35 AM Melvin Davidson > wrote: > >> >> Politely tell them to buy some of the many well written books that are >> available on these very topics... >> >Fair enough but what about t

Re: User documentation vs Official Docs

2018-07-19 Thread Melvin Davidson
>> Politely tell them to buy some of the many well written books that are available on these very topics... >Fair enough but what about those that cant afford it? I think us in the Western World tend to forget that by >far the majority of users cant afford a latte from Starbucks let alone a 60.00 U

Re: Disabling/Enabling index before bulk loading

2018-07-10 Thread Melvin Davidson
y, You may find find some are really not needed.* -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only! SELECT n.nspname as schema, i.relname as table, i.indexrelname as index,

Re: Cloning schemas

2018-07-09 Thread Melvin Davidson
source schema abd send me the call to clone schema that you are using. -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only! -- Function: public.clone_schema(text, text, boolean) -- DROP FUNCTION public.clone_schema(

Re: Cloning schemas

2018-07-09 Thread Melvin Davidson
and does WORK. Please do not muddle the problem without testing yourself. On Mon, Jul 9, 2018 at 2:56 PM, Adrian Klaver wrote: > On 07/09/2018 09:49 AM, Melvin Davidson wrote: > > >> >> On Mon, Jul 9, 2018 at 12:32 PM, DiasCosta > <mailto:diasco...@diascosta.org>&g

Re: Cloning schemas

2018-07-09 Thread Melvin Davidson
g} >ERROR: relation "bilhetica_logic_schema.idx_unq_cod_operador_aml" does not exist This is not related to the clone_schema function. It looks like you may have corruption in your syste catalogs, Try reindexing your system_catalogs. REINDEX VERBOSE SYSTEM ; -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: Cloning schemas

2018-07-09 Thread Melvin Davidson
n I will need you to do a pgdump -F p -t public.t_cpuinfo and send the output to me. -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!  -- Function: public.clone_schema(text, text, boolean) -- DROP FUN

Re: Cloning schemas

2018-07-07 Thread Melvin Davidson
2018-07-07 4:32 GMT-04:00 DiasCosta : > Hi Melvin, > > Thank you. > > Dias Costa > > On 04-07-2018 23:38, Melvin Davidson wrote: > > > > On Wed, Jul 4, 2018 at 2:48 PM, DiasCosta wrote: > >> Hi Melvin, >> >> I'm new to clone_schema. >

Re: Role problem in Windows

2018-07-06 Thread Melvin Davidson
ns some tables. So you can use the attached script and add 'AND a.rolname = 'xxx' to the WHERE clause. Then as a superuser you can use ALTER TABLE xyz OWNER TO new_owner for each table found. -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration C

Re: How to watch for schema changes

2018-07-05 Thread Melvin Davidson
>As I said I'm writing the client application with libpq/ODBC. How will I get >the results? Igor, You DO NOT need libpq/ODBC . Just use the count option of grep (-c). If it is greater than zero, then send a mail to yourself and/or attach the log for review. -- *Melvin Davidson* *Ma

Re: Cloning schemas

2018-07-05 Thread Melvin Davidson
gt; > czw., 5 lip 2018 o 16:02 Melvin Davidson > napisał(a): > >> >> >> On Thu, Jul 5, 2018 at 1:49 AM, Łukasz Jarych wrote: >> >>> From link function is not working. >>> >> >> There is no " From link" in PostgreSQL, >> Woul

Re: Cloning schemas

2018-07-05 Thread Melvin Davidson
On Thu, Jul 5, 2018 at 1:49 AM, Łukasz Jarych wrote: > From link function is not working. > There is no " From link" in PostgreSQL, Would you please be more specific. Please provide a working example.

Re: Cloning schemas

2018-07-04 Thread Melvin Davidson
>The folks that wanted transactional ALTER SEQUENCE might disagree:): Ah, so you mean the previous version was not working or sufficient? https://www.postgresql.org/docs/9.6/static/sql-altersequence.html -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration

Re: Cloning schemas

2018-07-04 Thread Melvin Davidson
On Wed, Jul 4, 2018 at 6:48 PM, Adrian Klaver wrote: > On 07/04/2018 03:38 PM, Melvin Davidson wrote: > >> >> >> On Wed, Jul 4, 2018 at 2:48 PM, DiasCosta > <mailto:diasco...@diascosta.org>> wrote: >> >> Hi Melvin, >> >> I&

Re: Cloning schemas

2018-07-04 Thread Melvin Davidson
source_schema text, dest_schema text, include_recs boolean) RETURNS void AS $BODY$ -- Initial code by Emanuel '3manuek' -- Last revision 2017-04-17 by Melvin Davidson -- Added SELECT REPLACE for schema views -- -- This function will clone all sequences, tables, index

Re: Cloning schemas

2018-07-04 Thread Melvin Davidson
On Wed, Jul 4, 2018 at 2:27 PM, Łukasz Jarych wrote: > Hi Melvin, > > > > Best, > Jacek > > > wt., 3 lip 2018 o 15:34 Melvin Davidson napisał(a): > >> >> >> >>> ERROR: BŁĄD: you cannot add to column "TopoToVersion_ID" DET

Re: How to watch for schema changes

2018-07-03 Thread Melvin Davidson
>I'm writing a client in C++ with libpq. So I will have to do a lot of polling . Can't you just run a cron job? -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: How to watch for schema changes

2018-07-03 Thread Melvin Davidson
>Unfortunately I'm stuck with 9.1. Have you thought about just setting *log_statement = 'ddl'* in postgresql.conf and just greping the log for CREATE and ALTER?

Re: Cloning schemas

2018-07-03 Thread Melvin Davidson
ma( source_schema text, dest_schema text, include_recs boolean) RETURNS void AS $BODY$ -- Initial code by Emanuel '3manuek' -- Last revision 2018-07-03 by Melvin Davidson -- Added ' OVERRIDING SYSTEM VALUE' for INSERT records -- -- This function will clone all seq

Re: Cloning schemas

2018-07-02 Thread Melvin Davidson
crement_by, >> > min... >> > > HINT: Maybe you wanted to point to column " >> "audit_sq.last_value"? >> > > QUERY: SELECT last_value, max_value, start_value, increment_by, >> > min_value, >> > > cache_value

Re: dumping only table definitions

2018-06-29 Thread Melvin Davidson
mission and its attachments without reading them > or saving them to disk. Thank you. > > What I do NOT want are all the millions (not literally but it feels like it J) of functions we have. It sounds like you would best be served by installing pg_extractor. In essence, it is a super fle

Re: We find few queries running three times simultaneously with same parameters on postgres db

2018-06-26 Thread Melvin Davidson
ate, query, wait_event_type, query_start, current_timestamp - query_start as duration FROM pg_stat_activity WHERE pg_backend_pid() <> pid ORDER BY 1, datname, query_start; -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

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

2018-06-20 Thread Melvin Davidson
On Wed, Jun 20, 2018 at 1:28 PM, Francisco Olarte wrote: > Melvin: > > Maybe old eyes, but ... > > On Wed, Jun 20, 2018 at 7:03 PM, Melvin Davidson > wrote: > >>Is there a way to be notified on the CREATE TABLE execution? > > Here is sample code that will

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

2018-06-20 Thread Melvin Davidson
;; END IF; END LOOP; END; $BODY$ LANGUAGE plpgsql VOLATILE COST 100; ALTER FUNCTION public.fn_notify_ddl() OWNER TO postgres; CREATE EVENT TRIGGER table_created_dropped ON DDL_COMMAND_END EXECUTE PROCEDURE public.fn_notify_ddl(); ALTER EVENT TRIGGER table_created_dropped

Re: PostgreSQL Volume Question

2018-06-15 Thread Melvin Davidson
or analysis)? or do I need some other > solutions or any extension? > > > Thanks > > On Thu, Jun 14, 2018 at 3:36 PM, Melvin Davidson > wrote: > >> >> >> On Thu, Jun 14, 2018 at 6:30 PM, Adrian Klaver > > wrote: >> >>> On 06/14/2018 02

Re: PostgreSQL Volume Question

2018-06-14 Thread Melvin Davidson
ess? > > >> Thanks in advance. >> > > > -- > Adrian Klaver > adrian.kla...@aklaver.com > > In addition to Ravi's and Adrian's questions: What is the hardware configuration? -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

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

2018-06-04 Thread Melvin Davidson
requirement is to get the server shutdown time whenever that event >occurs and insert into a table dynamically!! Is it possible? Since you have not stated your O/S, we cannot provide a specific solution. However, I can suggest that you use a command line script to grab the time from the log an

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

2018-06-04 Thread Melvin Davidson
org/PostgreSQL-general- > f1843780.html > > Look in your postgresql log. You should see a line similar to this" 2018-06-04 09:21:27 EDT LOG: database system is shut down -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: Question on disk contention

2018-05-31 Thread Melvin Davidson
On Thu, May 31, 2018 at 10:04 AM, Ron wrote: > On 05/31/2018 08:52 AM, Melvin Davidson wrote: > > > > On Thu, May 31, 2018 at 1:13 AM, Charles Clavadetscher < > clavadetsc...@swisspug.org> wrote: > >> Hi Melvin >> >> As an answer to a previous post

Re: Question on disk contention

2018-05-31 Thread Melvin Davidson
so that instead of one job finishing quickly, they both have to take turns waiting for needed information. That takes a lot longer, Try this, Select a table that has a lot of rows, ideally 1M+. Then start a query with a WHERE clause and see how long it takes. Then submit the same query fro

Re: Query running for 12 hours

2018-05-30 Thread Melvin Davidson
:* *From your explain, it looks like you need an index on this_.tarih, since it is doing a sequential scan when it should be using an index.* *Also, your main problem is that when you have two exact same queries executing at the same time, they will cause contention in* *the disk, and neither one will make much progress.* -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: How to drop a value from an ENUM?

2018-05-29 Thread Melvin Davidson
On Mon, May 28, 2018 at 11:08 PM, Torsten Förtsch wrote: > Hi, > > I am absolutely sure a certain value of one of my ENUM types is not used > in the entire database. Now I am asked to drop that value. Unfortunately, > there is no ALTER TYPE DROP VALUE. > > On my development box I tried > > delete

Re: Help in Postgresql

2018-05-22 Thread Melvin Davidson
want to access the information about queries and statistics *I strongly recommend you install PgBadger, which analyzes the log file to provide you the information you need.* *https://sourceforge.net/projects/pgbadger/ <https://sourceforge.net/projects/pgbadger/>* -- *Melvin Davidson*

Re: When use triggers?

2018-05-18 Thread Melvin Davidson
ustomer balance..EG: An INSERT, UPDATE or DELETE involving a customer payment (or in the case of banks (deposit or withdrawals) would automatically maintain the balance in the customer master record. -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: sql function with empty row

2018-05-16 Thread Melvin Davidson
; >> Phil >> >> >> >> > > -- > Adrian Klaver > adrian.kla...@aklaver.com > > *I would start by changing* * RETURNS substance* *to* *RETURNS RECORD* *Note: you might also conside using RETURNS TABLE(...)* *https://www.postgresql.org/docs/10/static/s

Re: Add schema to the query

2018-05-06 Thread Melvin Davidson
On Sun, May 6, 2018 at 10:33 PM, Melvin Davidson wrote: > > > On Sun, May 6, 2018 at 10:19 PM, Igor Korot wrote: > >> Hi, ALL, >> >> Is there an easy way to add the schema to the following query: >> >> SELECT u.usename FROM pg_class c, pg_user u WH

Re: Add schema to the query

2018-05-06 Thread Melvin Davidson
easy way to add the schema to the following query: You mean like this? SELECT u.usename, *n.nspname AS schema* FROM pg_class c *JOIN pg_namespace n ON n.oid = c.relnamespace,* pg_user u WHERE u.usesysid = c.relowner AND relname = ? -- *Melvin Davidson* *Maj. Database &a

Re: How to find the hits on the databases and tables in Postgres

2018-05-05 Thread Melvin Davidson
for that so it can full fill my requirement >> for it >> >> pgBadger has always been my goto tool for that: >> https://github.com/dalibo/pgbadger >> >> > There are some statistic per tables: .. select * from pg_stat_user_tables, > indexes: select * from pg_stat_user_indexes, and databases: select * from > pg_stat_database; > > Regards > > Pavel > > -- >> Bill Moran >> >> > -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: Inconsistent compilation error

2018-04-19 Thread Melvin Davidson
tually in production. So if you copy the actual function from the system that works * *and use that to frop and rebuild the function on the system that fails, does that resolve the problem? I suspect there is an error in the failing system that you have overlooked.* -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: Inconsistent compilation error

2018-04-18 Thread Melvin Davidson
> I'm unsure why you're considering >'blah_history.original_id' not to be an argument here. On Wed, Apr 18, 2018 at 9:50 PM, David Rowley wrote: > On 19 April 2018 at 13:28, Melvin Davidson wrote: > > It is not fine. You have specifed TWO percent signs (%)

Re: Inconsistent compilation error

2018-04-18 Thread Melvin Davidson
s TWO argumenrts,but you have only provided ONE -> r.* *Hence-> ERROR: too many parameters specified for RAISE * *https://www.postgresql.org/docs/9.6/static/plpgsql-errors-and-messages.html#PLPGSQL-STATEMENTS-RAISE <https://www.postgresql.org/docs/9.6/static/plpgsql-errors-and-messages.html#PLPGSQL-STATEMENTS-RAISE>" Inside the format string, % is replaced by the string representation of the next optional argument's value"*-- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: How to fetch data from tables in PostgreSQL

2018-04-18 Thread Melvin Davidson
e * *and retrieve the information that is important to you. When PostgreSQL is first installed it cannot possibly have any tables/information that you* *would consider important. * -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: Gratuitous use of savepoint considered silly, if not harmful

2018-04-13 Thread Melvin Davidson
ELETE" > 83 "TRUNCATE TABLE" > 6 "DROP TABLE" > 2 "CREATE INDEX" > 2 "CREATE TABLE AS" > > Anyway, I felt this was worth sharing :-) > > Thx > > -- > Jerry Sievers > Postgres DBA/Development Consulting > e: postgres.consult...@comcast.net > p: 312.241.7800 > > *As Forest Gump once said "Stupid is as stupid does". *😁 -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: pg_basebackup restore a single table

2018-04-11 Thread Melvin Davidson
> > > Not everyone has a spare machine and a few TB lying around... > > -- > Angular momentum makes the world go 'round. > > *>Can I do a restore of a single table or single base using the archive >generated for the basebackup ...* *As Ron has previously sta

Re: Postgresql Split Brain: Which one is latest

2018-04-10 Thread Melvin Davidson
*Vikas,* *Presuming the the real "master" will have additional records/rows inserted in the tables,* *if you run ANALYZE on the database(s) in both "masters", then execute the following query * *on both, whichever returns the highest count would be the real "master&q

Re: Rationale for aversion to the central database?

2018-04-09 Thread Melvin Davidson
e database or the application is strictly on a case by case basis. * -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: decompose big queries

2018-04-06 Thread Melvin Davidson
are optimisation fences: > https://blog.2ndquadrant.com/postgresql-ctes-are-optimization-fences/ > > > > -- > Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f184378 > 0.html > > -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe

Re: Problem with connection to host (wrong host)

2018-03-31 Thread Melvin Davidson
rameter It is not ignoring your entry, you simply have not entry for the laptop you are connecting from,So simply add the following:* *hostall all 192.168.0.2/32 ident * <- note, you may have to change the authentication method depending on your environment -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: Introducing brand-new dbForge Studio for PostgreSQL, a powerful IDE for working with PostgreSQL databases

2018-03-22 Thread Melvin Davidson
tor which help users create, develop and execute queries as well > >> as edit > >> and adjust the code to their requirements in a convenient and > >> user-friendly > >> interface./ > > > > (snip...) > > > > Windows only. Wake me up when

Re: PostgreSQL 9.6 Temporary files

2018-03-19 Thread Melvin Davidson
On Mon, Mar 19, 2018 at 1:17 PM, Jimmy Augustine wrote: > Hi, > > I used this command and I found the same value in total_size column. > > 2018-03-19 18:01 GMT+01:00 Melvin Davidson : > >> >> >> On Mon, Mar 19, 2018 at 12:45 PM, Adrian Klaver < >> a

Re: PostgreSQL 9.6 Temporary files

2018-03-19 Thread Melvin Davidson
nly looks at the current database* *but SELECT pg_size_pretty(pg_database_size('Database Name')); looks at ALL databases.* *Try this query instead to show individual database sizes.SELECT oid, datname,pg_size_pretty(pg_database_size(datname))as size_pretty,

Re: PostgreSQL 9.6 Temporary files

2018-03-19 Thread Melvin Davidson
On Mon, Mar 19, 2018 at 12:45 PM, Adrian Klaver wrote: > On 03/19/2018 09:31 AM, Jimmy Augustine wrote: > >> Dear Friends, >> >> I am newbie to postgresql. >> I have 162 GB on my database but when I check size of all tables, I >> approximately obtain 80 GB. >> I also see that I have 68GB of tempo

Re: Prompt for parameter value in psql

2018-03-16 Thread Melvin Davidson
round the text with single quotes.)* *By default, \prompt uses the terminal for input and output. However, if the -f command line switch was used, \prompt uses standard input and standard output.* -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: SELECT .. FOR UPDATE: find out who locked a row

2018-03-16 Thread Melvin Davidson
sql.org) for comment BEFORE said changes are implemented. On Thu, Mar 15, 2018 at 11:23 PM, Tom Lane wrote: > Melvin Davidson writes: > > Yes, Stephen, I certainly understand making changes to system catalogs > > _when necessary_. That being said, the first change was the renam

Re: SELECT .. FOR UPDATE: find out who locked a row

2018-03-15 Thread Melvin Davidson
On Thu, Mar 15, 2018 at 10:14 PM, Stephen Frost wrote: > Greetings Melvin, > > * Melvin Davidson (melvin6...@gmail.com) wrote: > > >I guess with your query I can figure out which connection holds a lock, > > but it seems I cannot correlate those locks to the rows which a

Re: SELECT .. FOR UPDATE: find out who locked a row

2018-03-15 Thread Melvin Davidson
and remove/replace another field. Hopefully they will refrain from doing so in the future, as it breaks queries and applications.* -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: SELECT .. FOR UPDATE: find out who locked a row

2018-03-15 Thread Melvin Davidson
ON (c.pid = l1.pid and not l1.granted) LEFT JOIN pg_locks l2 on (l1.relation = l2.relation and l2.granted) LEFT JOIN pg_stat_activity l ON (l2.pid = l.pid) LEFT JOIN pg_stat_user_tables t ON (l1.relation = t.relid) WHERE pg_backend_pid() <> c.pid ORDER BY datname, query_start; -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: Postgresql upgrade to 9.5.12/10.3 changes pg_dump format for cloning schemas

2018-03-13 Thread Melvin Davidson
On Tue, Mar 13, 2018 at 1:47 PM, Melvin Davidson wrote: > > > >> Thank you Melvin, I forgot to mention I've already found your script >> before I asked here, but I didn’t think it was robust enough (please don't >> offend :-). Particularly, it didn't

Re: Postgresql upgrade to 9.5.12/10.3 changes pg_dump format for cloning schemas

2018-03-13 Thread Melvin Davidson
at the reason it is failing is because, once again, the catalogs have been changed. In this case the structure of sequences. I am trying to find a workaround. I will get back to you when I do. -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: UPSERT on a view

2018-03-13 Thread Melvin Davidson
On Tue, Mar 13, 2018 at 10:02 AM, David G. Johnston < david.g.johns...@gmail.com> wrote: > On Tue, Mar 13, 2018 at 6:47 AM, Melvin Davidson > wrote: > >> On Mon, Mar 12, 2018 at 2:26 PM, Steven Roth >> wrote: >> >>> This code raises the error &#x

Re: UPSERT on a view

2018-03-13 Thread Melvin Davidson
unction_name ( arguments ) *Please also note that it is very helpful if you specify PostgreSQL version and O/S when submitting to this list.* -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: Programmatically duplicating a schema

2018-03-13 Thread Melvin Davidson
Itnow copies all sequences, tables, indexes, rules, triggers, data(optional), views & functions from any existing schema to a new schema.Then just call the function.SAMPLE CALL:SELECT clone_schema('public', 'new_schema', TRUE);Use FALSE if you do not want to copy da

Re: psql in a bash function

2018-03-12 Thread Melvin Davidson
pg_database_size(datname) as size, (SELECT pg_size_pretty (SUM( pg_database_size(datname))::bigint) FROM pg_database) AS total, (pg_database_size(datname) / (SELECT SUM( pg_database_size(datname)) FROM pg_database) ) * 100::numeric(6,3) AS pct FROM pg_database d JOIN pg_authid a ON a.oid = datdba WHERE datname LIKE '%$DBNAME%' ORDER BY datname; _EOF_ -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: wrong message when trying to create an already existing index

2018-03-10 Thread Melvin Davidson
ns_ as defined in relkind, and therefore reports a generic message as"relation _relname_ already exists"To report on a specific relation type would be redundant, because you already knowfrom your SQL statement what type/relkind of relation you are trying to CREATE.IE: SQL> crea

Re: Postgresql upgrade to 9.5.12/10.3 changes pg_dump format for cloning schemas

2018-03-09 Thread Melvin Davidson
*Melvin DavidsonMaj. Database & Exploration SpecialistUniverse Exploration Command – UXC* Employment by invitation only! -- Function: public.clone_schema(text, text, boolean) -- DROP FUNCTION public.clone_schema(text, text, boolean); CREATE OR REPLACE FUNCTION public.clone_schema( sou

Re: save query as sql file

2018-03-07 Thread Melvin Davidson
>> adrian.kla...@aklaver.com >> > > > trying to save query as sql file in pg_admin4 but file --> save as not exists like here: As previously answered, you have to use the icon(s) for all options in the query window FYI,In October 2017, I entered Feature request #2797 in PgAdmin's redmin to add a MENU to the query window in addition to the icons. That request is still open. https://redmine.postgresql.org/issues/2797 -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: Can I grant permissions to specific set of uids (linux) ?

2018-03-06 Thread Melvin Davidson
ttps://www.postgresql.org/docs/current/static/sql-grant.html <https://www.postgresql.org/docs/current/static/sql-grant.html>*-- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: Enforce primary key on every table during dev?

2018-03-01 Thread Melvin Davidson
> garbage into the table? I'm afraid I don't quite get what you're saying. > > > If your only unique index is a synthetic key, then you can insert the same > "business data" multiple times with different synthetic keys. > > > -- > Angular momentum makes the world go 'round. > * If you are going to go to the trouble of having a surrogate/synthetic key, then you may as well have a primary key , which is much better. * -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

Re: Version upgrade: is restoring the postgres database needed?

2018-03-01 Thread Melvin Davidson
On Thu, Mar 1, 2018 at 12:22 PM, Ron Johnson wrote: > On 03/01/2018 11:03 AM, Melvin Davidson wrote: > > > > On Thu, Mar 1, 2018 at 11:51 AM, Ron Johnson > wrote: > >> On 03/01/2018 10:37 AM, Vick Khera wrote: >> >> On Thu, Mar 1, 2018 at 11:15 AM,

Re: Version upgrade: is restoring the postgres database needed?

2018-03-01 Thread Melvin Davidson
res| postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | > > > -- > Angular momentum makes the world go 'round. > *>$ pg_dump -Fc PROD > PROD.pgdump >$ pg_dump --globals-only postgres > globals.sql >$ pg_dump -Fc postgres > postgres.pgdump * *The la

Re: Enforce primary key on every table during dev?

2018-03-01 Thread Melvin Davidson
re is no forest. > > *> it is common practice to denormalize data without a>requirement to be able to identify a single record * *You may perceive that to be "common practice", but in reality it is not, and in fact a bad one. As was previously stated, PosgreSQL is a _relat

Re: Version upgrade: is restoring the postgres database needed?

2018-03-01 Thread Melvin Davidson
roles and databases are contained in the output file created. NOTE: restoring from the dumped file will require rebuilding all indexes, because indexes are not dumped. -- *Melvin Davidson* *Maj. Database & Exploration Specialist* *Universe Exploration Command – UXC* Employment by invitation only!

  1   2   >