Re: [SQL] Advice for generalizing trigger functions
--- Richard Broersma Jr <[EMAIL PROTECTED]> wrote: > I've created quite a few functions that log modifications to various > history tables. (the history table has the same name as the base > table but is prefixed by the 'History.' schema.) The only difference > between functions I can find is the table name. the problem is that prepared code is referenced by oid, not name. so any structural references need to by dynamic. what I do for change log is to have one change log table with table_id and column_id attributes that refer by to my internal meta_table and meta_column tables. this always works and is in the end, I have found, a bit more flexible, allowing you to search for changed columns, for example. but I still generate the change triggers. in this case from in my meta_table and meta_column tables I note which table/columns I want changes tracked. those can be changed at any time, but the change log triggers need to be recompiled. Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
[SQL] need help
is there any one online in yahoo messenger right now..? Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
Re: [SQL] Advice for generalizing trigger functions
--- On Wed, 12/26/07, chester c young <[EMAIL PROTECTED]> wrote: > what I do for change log is to have one change log table with table_id > and column_id attributes that refer by to my internal meta_table and > meta_column tables. this always works and is in the end, I have found, > a bit more flexible, allowing you to search for changed columns, for > example. I agree that EAV history tables are far more flexible than creating separate history tables for each base table. Especially since this design choice does not require modifications when tables are created, altered, or dropped. However, I was looking to utilize functionality that an EAV history table can't provide. For example, I replace joins to the Project.Managers table with joins to the History.Managers table and with a timestamp of interest to reproduce query results of the database's state that existed in "times passed". If I didn't need to regularly provide this functionality, I would certainly use an EAV history table. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [SQL] need help
--- On Wed, 12/26/07, A. Wiryawan <[EMAIL PROTECTED]> wrote: > From: A. Wiryawan <[EMAIL PROTECTED]> > Subject: [SQL] need help > To: pgsql-sql@postgresql.org > Date: Wednesday, December 26, 2007, 11:19 AM > is there any one online in yahoo messenger right now..? I am not, but you can find alot of PostgreSQL people on IRC: http://www.postgresql.org/community/irc Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org
Re: [SQL] need help
--- On Wed, 12/26/07, A. Wiryawan <[EMAIL PROTECTED]> wrote: > niwey do you have any e-books abour postgresql to be > shared, if you don't mind please sent me Sure, There are lots of books on the Postgresql site: http://www.postgresql.org/docs/8.2/interactive/index.html http://www.postgresql.org/docs/techdocs.4 http://www.postgresql.org/docs/techdocs.2 Also, I should let you know that there are good practices to follow when sending emails to any of the PostgreSQL mailing lists. 1) when ever you reply to an email from the mailing list, make sure to reply all. Sometimes other list subscribers can join in answering your emails. However, if you only reply to me they will not have that chance. Also, I might be to busy to repond at times, so repling to the whole mailing list will help you get answers more quickly. 2) the community of behind this mailing list asks that we use bottom posting when we reply to an email. It is not preferred to put your replies at the top of the email. 3) Try to use descriptive email subjects. For example, your email subject was "need help". This subject could be improved to say "Need links to online postgresql references." Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 6: explain analyze is your friend
[SQL] how to use pgsql like mssql
in the pgadmin editi want usedeclare ...if exists ...insert something if @@rowcout>0 then do somethingif like in mssql and not use functionhow tosorry for my english
Re: [SQL] how to use pgsql like mssql
--- On Wed, 12/26/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > in the pgadmin edit > i want use > declare ... > if exists ... > insert something if @@rowcout>0 then do something > if > like in mssql and not use function I take it that you are looking to create stored procedures? In postgresql they are called "stored functions" or more correctly "functions." First you will need to load a procedural language into your database if one isn't already installed. http://www.postgresql.org/docs/8.2/interactive/sql-createlanguage.html You should probably use PLpgSQL since it is available across OS all platforms and is easy to learn and use. http://www.postgresql.org/docs/8.2/interactive/plpgsql.html There are some nice examples in this documentation. Your PGadmin will also have features to help the create these functions also. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 6: explain analyze is your friend
Re: [SQL] how to use pgsql like mssql
but i do not want use function or procedure wish this features
Re: [SQL] how to use pgsql like mssql
--- On Wed, 12/26/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > but i do not want use function or procedure Are you sure? I thought that: DECLARE IF --control structures @@rowcount where only usable in a store procedure. Am I incorrect, or are these keywords accessible from the SQL prompt? Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org
Re: [SQL] how to use pgsql like mssql
Hello On 27/12/2007, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > but i do not want use function or procedure > > wish this features > PostgreSQL doesn't support this feature. You can use procedural construct only in functions. Regards Pavel Stehule > > > > ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [SQL] how to use pgsql like mssql
On 27/12/2007, Richard Broersma Jr <[EMAIL PROTECTED]> wrote: > --- On Wed, 12/26/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > but i do not want use function or procedure > > > Are you sure? I thought that: > > DECLARE > IF --control structures > @@rowcount > > where only usable in a store procedure. Am I incorrect, or are these > keywords accessible from the SQL prompt? > You can use outside procedure in T-SQL. Pavel > Regards, > Richard Broersma Jr. > > ---(end of broadcast)--- > TIP 4: Have you searched our list archives? > >http://archives.postgresql.org > ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster