0
votes
0answers
36 views

SQL after trigger not counting correctly

I have two tables, tasks and subtasks. Every subtask has a status (PENDING when first inserted). Then I run threads that update every subtask (the status becomes READY). What I want is when every ...
0
votes
1answer
45 views

Postgresql - trigger adds twice

I have many triggers in my tables, but one behaves not exactly like I want it. This one counts products and price and returns total price for order - works ok: CREATE OR REPLACE FUNCTION ...
0
votes
1answer
36 views

PostgreSQL Stock Update Trigger

I have 2 tables in PostgreSQL: lines(idlines,iditems,quantity) and items(iditems,stock). iditems is a foreign key in lines. I need a trigger that updates the stock field from the items table when a ...
0
votes
3answers
46 views

postgres update rule wont insert

i have a simple table: CREATE TABLE aaa_has_bbb ( aaa_id integer not null, bbb_id integer not null, rank integer not null, primary key(aaa_id, bbb_id), uniq(aaa_id, rank) ) I ...
-1
votes
1answer
21 views

PgSQL trigger on a view with storage's rule

I apologize in advance for my English; I have a problem with the trigger on the view of the rule of storage trigger looks like this: CREATE TRIGGER AFTER INSERT ON add_count test.v_wszystkie FOR EACH ...
0
votes
1answer
36 views

PostgreSQL - set a default cell value according to another cell value

If i have a column say column a of any given values, and i want another column column b to have a default value according to the value of column a In another words: if column a = 'peter' then column ...
0
votes
1answer
25 views

Postgres avoid Trigger on delete cascade

Hello i have a problem with a Trigger i have 2 tables: t_mandant t_user_has_mandant when i delete a row in t_user_has_mandant i call a trigger beforeDeleteUserMandant() but i need a possibility ...
0
votes
1answer
97 views

Custom auto-increment field in postgresql (Invoice/Order No.)

The baseline requirement is to create an order number in the format: (M)M-SSS Where MM represents the current month and SSSS represents the order sequence for that month. For example 1-002 would ...
0
votes
1answer
68 views

Select a column default value into a variable in Pl/PgSQL

I'm trying to implement a generic trigger procedure to enable a sort a versioning scheme on tables. Tables all have version and current fields. On updates, in some situations based on a condition, i ...
0
votes
1answer
23 views

how to circumvent missing record type on insert

I'd like to make a copy of a row in one table addressed by a field in another table, like this: CREATE OR REPLACE FUNCTION f_ins_up_vorb() RETURNS TRIGGER AS $$ DECLARE dienst ...
1
vote
2answers
87 views

Inserted, Deleted tables in postgreSQL, like SQL Server?

I want to create a trigger after a inserted event, but I need the data that I inserted in order to register into a new table for my trigger in PostgreSQL In SQL Server I capture these values from the ...
2
votes
2answers
63 views

a postgres update trigger performs everything else except the actual update

Let's use a test table : CREATE TABLE labs.date_test ( pkey int NOT NULL, val integer, date timestamp without time zone, CONSTRAINT date_test_pkey PRIMARY KEY (pkey) ); I have a trigger ...
0
votes
3answers
31 views

Cycloning in trigger

I have table like this id | col1 | col2 I need write trigger so: after inserting or updating column col1 , I need insert (update) same value in column col2 This is my trigger function: CREATE ...
0
votes
1answer
33 views

PostgreSQL set a table age based on a date

I've run into a problem with my postgreSQL database. I have a table with a name, date of birth, and age. CREATE TABLE guy (name VARCHAR(10), dob DATE, ...
1
vote
1answer
41 views

PostgreSQL trigger raises error 55000

after migrating from PostgreSQL server version 9 to 8.4 I have encountered very strange error. Short description: If there is a trigger on a given table for each row before insert or update and one ...

1 2 3 4 5 19
15 30 50 per page