search for: plpgsql

Displaying 16 results from an estimated 16 matches for "plpgsql".

Did you mean: pgsql
2010 Mar 10
0
Postgres plpgsql is created by default in new version, but schema dump tries to create it
As of some recent version of Postgres, plpgsql is created for new databases by default, but the sql schema export (config.active_record.schema_format = :sql) expots a create command in development_structure.sql, resulting in an error. CREATE PROCEDURAL LANGUAGE plpgsql; I could not find the version this changed in, however it is noted here:...
2006 May 18
5
Overriding default DELETE behavior with logical deletes
Hello! I am trying to figure out how to implement *logical deletes* instead of physical deletes using ActiveRecord. Basically, in many applications that deal with E-Commerce, you really can''t physically delete almost anything, because records must be kept for auditing and customer service tracking purposes. In the past, I''ve implemented logical deletes as follows: 1.
2015 Jul 24
0
possible patch for ACL SQL ERROR: duplicate key value violates unique constraint "user_shares_pkey"
...breaking the recursive triggers. This assumes that dummy is never NULL from Dovecot. The same applies to anyone_shares, just remove the to_user field from the function. Does somebody see something wrong with my hack? ============= CREATE FUNCTION insert_sharing() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN IF NEW.dummy IS NULL THEN -- ugly kludge: we came here from this function, really do try to insert return NEW; END IF; LOOP UPDATE user_shares SET dummy = NEW.dummy WHERE from_user = NEW.from_user AND to_user = NEW.to_user; IF found THEN...
2009 Aug 09
1
Wiki entry for expire plugin, PostgreSQL trigger needs update
...RIGGER AS $$ BEGIN IF exists(SELECT 1 FROM expires WHERE username = NEW.username AND mailbox = NEW.mailbox) THEN UPDATE expires SET expire_stamp = NEW.expire_stamp WHERE username = NEW.username AND mailbox = NEW.mailbox; RETURN NULL; ELSE RETURN NEW; END IF; END; $$ LANGUAGE plpgsql; CREATE TRIGGER mergeexpires BEFORE INSERT ON expires FOR EACH ROW EXECUTE PROCEDURE merge_expires(); At least that's what I think after looking at the code: iter = dict_iterate_init(dict, DICT_EXPIRE_PREFIX, DICT_ITERATE_FLAG_RECURSE | DICT_ITERATE_FLAG_SO...
2011 Dec 15
1
Quota PostgreSQL INSERT trigger
...URN NULL; END IF; BEGIN IF NEW.messages = 0 THEN RETURN NEW; ELSE NEW.messages = - NEW.messages; RETURN NEW; END IF; EXCEPTION WHEN unique_violation THEN -- someone just inserted the record, update it END; END LOOP; END; $$ LANGUAGE plpgsql; DROP TRIGGER IF EXISTS mergequota2 ON quota2; CREATE TRIGGER mergequota2 BEFORE INSERT ON quota2 FOR EACH ROW EXECUTE PROCEDURE merge_quota2(); --- Best regards, Adis
2008 Dec 05
0
test:clone_structure problems with Postgres
...ucture:dump (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:structure:dump ** Invoke db:test:purge (first_time) ** Invoke environment ** Execute db:test:purge ** Execute db:test:clone_structure psql:db/development_structure.sql:15: ERROR: language "plpgsql" already exists This doesn''t seem to be a common configuration problem. I did try "dropping: the language on the command line, but no help. any ideas would be appreciated... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscri...
2009 Jan 19
0
Reject message if user is over quota. 2/3 solution for Postfix w/ PostgreSQL
...result := '552 5.2.2 Quota exceeded (mailbox for user is full)'; ELSE IF messages >= q_msgs THEN result := '552 5.2.2 Quota exceeded (mailbox for user is full)'; END IF; END IF; RETURN result; END; $$ LANGUAGE plpgsql STABLE RETURNS NULL ON NULL INPUT EXTERNAL SECURITY INVOKER; GRANT SELECT ON quota TO $Your_Postfix_database_user; Regards, Pascal -- Ubuntu is an ancient African word meaning ?I can?t install Debian.? -- unknown
2019 Sep 03
0
Quota count and clone questions
...inserts new record with actual quota, to be able to get correct results in postfixadmin one must: DROP TRIGGER mergequota2 ON quota2; And to prevent ERROR: duplicate key value violates unique constraint "quota2_pkey": CREATE FUNCTION public.clone_quota2() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN UPDATE quota2 SET bytes = NEW.bytes, messages = NEW.messages WHERE username = NEW.username; IF found THEN RETURN NULL; ELSE RETURN NEW; END IF; END; $$...
2006 Jul 11
18
Zip Code Ranges
Does anyone have any recommendations for working with zip code distance ranges? I need to calculate the distances between US zip codes. Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060711/f133d7de/attachment-0001.html
2015 Oct 16
0
quotas configuration a few questions
...username); ELSE INSERT INTO quota (bytes, messages, username) VALUES (NEW.bytes, -NEW.messages, NEW.username); END IF; return NULL; EXCEPTION WHEN unique_violation THEN -- someone just inserted the record, update it END; END LOOP; END; $$ LANGUAGE plpgsql; DROP TRIGGER IF EXISTS mergequota ON quota; CREATE TRIGGER mergequota BEFORE INSERT ON quota FOR EACH ROW EXECUTE PROCEDURE merge_quota(); --(postgresql stuff)-- ============ /etc/dovecot/dovecot-dict-sql.conf connect = host=/run/postgresql dbname=mail user=mailreader map {...
2005 Oct 28
3
PostgreSQL. Multiply schemas in one database. How to?
...rkthrone" already exists ** Execute clone_structure_to_test psql:db/development_structure.sql:13: ERROR: schema "development" already exists psql:db/development_structure.sql:27: ERROR: schema "test" already exists psql:db/development_structure.sql:34: ERROR: language "plpgsql" already exists psql:db/development_structure.sql:45: ERROR: function "gtsvector_in" already exists with same argument types psql:db/development_structure.sql:54: ERROR: function "gtsvector_out" already exists with same argument types psql:db/development_structure.sql:67: E...
2007 Nov 15
3
Graphics device storable in a variable
I'm using R embedded in PostgreSQL (via PL/R), and would like to use it to create images. It works fine, except that I have to create every image in a file (owned by and only readable by the PostgreSQL server), and then use PostgreSQL to read from that file and return it to the client. It would be much nicer if I could plot images into an R variable (for instance, a matrix), and return that
2007 Apr 30
5
Asterisk 1.4.4 VoiceMail ODBC Storage Help
Hi All, I have an issue with the ODBC voicemail storage option with asterisk. All appears to work fine, however, I get several sql execute warnings. I was wondering if anyone out there could help me get to the bottom of what is causing this and how I could possibly go about rectifying it. The warning message we are getting is as follows: WARNING[30115]: app_voicemail.c:1280 delete_file: SQL
2009 May 09
41
updating the db 6000 times will take few minutes ?
i am writing a test program for ActiveRecord, and it reads a document which is like 6000 words long. And then i just tally up the words by recordWord = Word.find_by_s(word); if (recordWord.nil?) recordWord = Word.new recordWord.s = word end if recordWord.count.nil? recordWord.count = 1 else recordWord.count += 1 end recordWord.save and so this
2008 May 16
6
Some architecture questions for my mongrelian friends
Hey, I''m working on a project, and mongrel may be part of the stack, but I''ve got some more general questions and ideas I''m hoping to run by this list. The people on this list have a broader knowledgebase and more experience than any place else I know - plus a general friendliness and willingness to help! I''m working with a company who has a really antique
2005 Mar 09
26
OT: Best DB
I know this is a bit off topic but we are using Asterisk :) Since this list is full of tech gurus w/ all different sorts of backgrounds, I thought I would get the best opinions here. We have several different switches and other telecom equipment at our facilities which all have their own proprietary cdr platforms, which are rather limited. The company I work for is looking to develop their