Tagged Questions
0
votes
0answers
19 views
Trigger procedure in PostgreSQL
I'm trying to implement a trigger procedure and I'm kind of stuck. I have a table product and a table productPhotos. Here's the structure of productPhotos:
CREATE TABLE dim_product_photo
(
photo_id ...
0
votes
1answer
23 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
39 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
16 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
32 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
20 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
72 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
47 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
22 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
70 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
50 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
26 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
34 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 ...
0
votes
2answers
67 views
PostgreSQL Mathematical Function
I have a table aps_sections with many integer fields (such as bare_width and worn_width). I also have multiple look up tables (such as aps_bare_width and aps_worn_width) which contain an ID column and ...