Reputation: 614
I have Postgresql DB with separate table for each worker,the table name as the worker name.
I have a table that holds workerID and workerName.
I want to make a function the will insert the data to the correct table by ID.
part of the code:
DECLARE
user_name text ;
BEGIN
user_name := (select user FROM workerTable WHERE workerID = TG_ARGV[2])::text;
INSERT INTO user_name::tablename ...
I'll be happy for any guidelines in this subject. Thank you in advance
Upvotes: 0
Views: 137
Reputation: 30324
My guideline is you shouldn't be using a separate table for each worker.
Upvotes: 2