Problem with connection to host (wrong host)

2018-03-31 Thread Mike Martin
Hi I am just setting up a postgres server, details Host 192.168.0.3 pg_hba.conf # TYPE DATABASEUSERADDRESS METHOD # "local" is for Unix domain socket connections only local all all peer # IPv4 local connections:

Regex on field value

2018-04-14 Thread Mike Martin
Is this possible, eg Substring(field, regex include other field name) Thanks

Question about getting values from range of dates

2018-06-22 Thread Mike Martin
Hi I am looking for suggestions about the best way to resolve this problem. Scenario I have entries for files in database which lack specific values (xml files not generated) These values can be obtained by what are called DTC read files, where the values are the same in the last DTC read file be

Advice on logging strategy

2018-10-11 Thread Mike Martin
I have a question on logging strategy I have loggin set to log_statement = 'all' on a network database with logging set to csv so I can import it to a logging table However the database is populated via a nightly routine downloading data via REST APIusing prepared statements This results in enor

Re: Advice on logging strategy

2018-10-11 Thread Mike Martin
I suppose the ideal would be to log the prepared statement once and detail only if error rather than one per execution On Thu, 11 Oct 2018 at 11:33, Rob Sargent wrote: > > > > On Oct 11, 2018, at 4:26 AM, Mike Martin wrote: > > > > I have a question on logging strate

Re: Advice on logging strategy

2018-10-12 Thread Mike Martin
Thanks! On Fri, 12 Oct 2018 at 14:33, David Steele wrote: > On 10/11/18 11:26 AM, Mike Martin wrote: > > > > This results in enormous log files which take ages to import using copy > > becuase each execute statement is logged with the parameters chosen > > >

Stored procedure with execute and returning clause

2020-08-23 Thread Mike Martin
Hi I am having difficulty with returning clause and stored procedure. This is an (edited) example of where I am CREATE OR REPLACE PROCEDURE public.arrcopy1( dataarr anyarray, tblname text, cols text DEFAULT NULL::text, selstr text DEFAULT NULL::text, INOUT outarr text[] DE

Return value of CREATE TABLE

2020-09-10 Thread Mike Martin
Is this possible? Basically I want to manage temp table status for use in a procedure. The procedure looks at pg_catalog to get information for processing. So basically I would like to be able to know what namespace a temp table is created in, so that I can constrain lookup. example CREATE TEMP

Re: Return value of CREATE TABLE

2020-09-10 Thread Mike Martin
Thanks , exactly what I was looking for On Thu, 10 Sep 2020 at 13:16, Christoph Moench-Tegeder wrote: > ## Mike Martin (redt...@gmail.com): > > > So basically I would like to be able to know what namespace a temp table > is > > created in, so that I can constrain lookup.

Shell Command within function

2018-10-26 Thread Mike Martin
Is this possible? I have a script which imports csvlogs into a table, and it would be useful to truncate the log files after import thanks Mike

Problem with commit in function

2018-10-30 Thread Mike Martin
I have the following function -- FUNCTION: public.update_log() -- DROP FUNCTION public.update_log(); CREATE OR REPLACE FUNCTION public.update_log( ) RETURNS void LANGUAGE 'sql' COST 100 VOLATILE AS $BODY$ truncate table postgres_log_tmp ; COPY postgres_log_tmp FROM '/mnt/pgdata

Code for getting particular day of week number from month

2018-12-11 Thread Mike Martin
Hi For a particular sequence I needed to do (schedule 2nd monday in month for coming year) I created the following query select to_char(min(date::date) + interval '1 week','DD/MM/') date --gets first date for day of month (monday in this case) then adds week and finally formats it to desi

How to compare dates from two tables with blanks values

2018-12-19 Thread Mike Martin
I have a situation where I need to update dates in a primary table from regular imports of data, eg: this is the base select query select d.row_id, fname||lname,'joineddate',d.joineddate,'joineddate',s.joineddate,0 as bool1 from import s join members d on d.contact_id=s.contact_id where cast(nul

Re: How to compare dates from two tables with blanks values

2018-12-21 Thread Mike Martin
19/12/2018 à 11:41, Mike Martin a écrit : > > cast(nullif(d.joineddate,NULL) as timestamp) != > cast(nullif(s.joineddate,'') as timestamp) > Try with > d.joineddate IS DISTINCT FROM s.joineddate > > https://www.postgresql.org/docs/current/functions-comparison.html > > Cheers > -- > Arnaud > >

Array_agg and dimensions in Array

2019-01-13 Thread Mike Martin
I have come across a problem which I cant seem to solve in a nice way Basically I have a (small) table of tags What I need to is combine two concatenated fields with a literal value as an array element. First thought was using array_agg with a pre-created array as select array_agg(ARRAY['-metadat

Is it possible to have a cascade upwards query?

2019-03-27 Thread Mike Martin
As per title, is this possible? Scenario being two tables with a linking pair of fields, where one table is a superset of the other and key is generated by the second table I would like to have the record in table two deleted when I delete the record in table 1 Thanks

Problem with connecting with named host parameter

2021-08-27 Thread Mike Martin
Hi I am getting the following error when I connect with hostname on localhost psql -h capture -U -p 5432 psql: error: FATAL: no pg_hba.conf entry for host "fe80::7285:c2ff:feb0:cd4%eth0", user "usevideo", database "usevideos", SSL off The hba.conf is local all all

Re: Problem with connecting with named host parameter

2021-08-27 Thread Mike Martin
On Fri, 27 Aug 2021 at 15:00, Tom Lane wrote: > Mike Martin writes: > > I am getting the following error when I connect with hostname on > localhost > > > psql -h capture -U -p 5432 > > psql: error: FATAL: no pg_hba.conf entry for host > > "fe80::72