Re: Trigger bug ?

2019-05-22 Thread PegoraroF10
sorry, I wasn´t clear, when I sad returning Null I tried to say that new.PK was Null, not the function result. Try to create exactly what I sent you and you´ll see null values on that pk. And that occurs just because that trigger was created without EACH ROW/STATEMENT. So, my question is, PG shou

Re: Trigger bug ?

2019-05-22 Thread PegoraroF10
I´m not saying it should inspect function code, but I think it should deny when I try to create a trigger missing a needed argument. When I do ... create table MyTable(integer); gives me an "syntax error at end of input" because I forgot field name. why when I do ... create trigger MyTrigger aft

Re: Trigger bug ?

2019-05-22 Thread PegoraroF10
ok, you won. Sorry, I didn´t read that "If neither is specified, FOR EACH STATEMENT is the default" -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html

with and trigger

2019-05-29 Thread PegoraroF10
We like to use With to insert, update and return some value to user. But some informations of those related tables are not available on that time, is that a bug ? with Master(Master_ID) as (insert into Master(Customer_ID, Field2) values(1, 'BlaBla') returning Master_ID), Detail as (insert int

Re: with and trigger

2019-05-29 Thread PegoraroF10
Well, I think is not a transaction problem, because if you do the same thing on a DO it will work. DO $$ declare vMaster_ID integer; begin insert into Master(Customer_ID, Field2) values(1, 'BlaBla') returning Master_ID into vMaster_ID; insert into Detail(Master_ID, Product_ID, ProductValue)

json on child table or not

2019-05-31 Thread PegoraroF10
I have a table with lots of updates in a json field and few updates on other fields. On that table I have several indices and it is main table of other lots of child tables. When querying this table I always do a lateral join with that json field, so having that field on a separate table wouldn´t b

Re: json on child table or not

2019-05-31 Thread PegoraroF10
Yes, they are jsonb. Their length varies between 400 and 2.000 chars, when using pg_column_size(jsonb field). When casting to text it goes to 1.800 to 3.500 of length. I didn´t set any storage strategie for that table or field. It´s defined as x for storage. No, I don´t have any index on that field

dump and restore ordered by schema or table name

2019-06-04 Thread PegoraroF10
Our database has 180 schemas with 100 tables each, with majority of them being small tables. Then, when we do a dump or restore we don´t know how much time it´ll spend to do that job. So, there is an option to dump or restore ordered alphabetically ? It could be by schema or table, do we have it ?

Converting to identity columns with domains on PK columns

2019-07-04 Thread PegoraroF10
Domains on Postgres are really strange to me. Am I creating a domain which is exactly equal to integer, right ? create domain i32 as integer; create domain T50 as varchar(50); Create table MyTable( ID I32 not null primary key, Description T50); Then, after inserts and updates done to that table,

Re: Converting to identity columns with domains on PK columns

2019-07-04 Thread PegoraroF10
ok, thanks for the explanation but ... I cannot add a field and move data, constraints, triggers, identity to it because my pk field will be repositioned to the last field on that table and I have lots of other codes which point to pk as the first field on every table. So, there is a way to conver

Cascade publication with pg_stat_replication empty

2021-04-07 Thread PegoraroF10
I have a server which replicates using Publication/Subscription. On subscriber server I have some ETL processes running on it and from this second server I´ve created a new publication to send this database to a third server. While this second server was copying data with COPY to third, everything

Re: Cascade publication with pg_stat_replication empty

2021-04-08 Thread PegoraroF10
On publisher it shows me "terminating walsender process due to replication timeout" But the problem is that this message is occurring 3 or 4 times a day only. It tries to send data, gets a timeout then shows the message. Then it waits a long long long time to try again, I don´t know why. wal_send

Re: Cascade publication with pg_stat_replication empty

2021-04-08 Thread PegoraroF10
So, there is a way to call replication, to client restart connection and try again ? Because aparently it stays disconnected for hours to try again, gets that timeout message and remains disconnected for hours again -- Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.htm

execute block like Firebird does

2018-02-10 Thread PegoraroF10
We are migrating our databases from Firebird to PostGres. A useful feature Firebird has is Execute Block. What it does is just return a record set from that dynamic SQL, just like a PostGres function, but without creating it. It sound like ... execute block returns(ID Integer, Name varchar(50), Las

Re: execute block like Firebird does

2018-02-11 Thread PegoraroF10
but DO doesn´t return values, or it does ? execute block returns(ID Integer, Name varchar(50), LastInvoice Date, ...) as begin for select ID, Name from Customers where ... into ID, Name do begin select bla, bla, bla from functionX(ID) into ...; if ... then bla = X else

Re: execute block like Firebird does

2018-02-12 Thread PegoraroF10
We can change all those execute blocks, but it would be a huge work if we need to rewrite them all. Today, just for a test, I replaced a Firebird execute block to a Postgres CTE. OK, worked but I spend 40 minutes and the problem is that we have hundreds of these execute blocks and on each one we ne

Re: execute block like Firebird does

2018-02-12 Thread PegoraroF10
I know I need to think a different approach of what execute blocks does on Firebird. What I was trying to was just let them the way they were wrote, because their results are correct and with more time replace them to a new way. But, if that way cannot be used, I´ll probably write some hundred o

Re: execute block like Firebird does

2018-02-12 Thread PegoraroF10
Explaining better my problem. All reports our customer use are customizable. So, when a customer runs a report it just runs all SQLs that are inside that report, being SQL or Execute Blocks. But because they are completelly customizable, one customer has 80 reports with 300 Execute Blocks on them a

Re: execute block like Firebird does

2018-02-12 Thread PegoraroF10
I loved Firebird but now we have to have some cool things that Postgres has and Firebird doesn´t. Fiirebird has just 3 cool features that Postgres doesn´t: Computed by columns, Position for fields and triggers and execute blocks, just that. Replication, PITR, JSON and JSONB, XML, inherited tables

<    1   2