Re: [GENERAL] Insert or Update a path from textbox...

2010-05-31 Thread Alban Hertroys
On 31 May 2010, at 23:27, wrote: > Hi, > > I'm just try to insert or update an actually table with Microsoft .NET > platform VS2005. > > The problem is that de "\" dissapear when I make the insert or Update. Postgres is interpreting those backslashes as escape characters. Either escape the

[GENERAL] Insert or Update a path from textbox...

2010-05-31 Thread david.catasus
Hi, I'm just try to insert or update an actually table with Microsoft .NET platform VS2005. The problem is that de "\" dissapear when I make the insert or Update. If i debug the object has all detailed path...so Why is not saved on the table. The type of column is character (100). So: I have:

Re: [GENERAL] INSERT or UPDATE

2009-04-10 Thread Dann Corbit
> -Original Message- > From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general- > ow...@postgresql.org] On Behalf Of James B. Byrne > Sent: Monday, April 06, 2009 1:46 PM > To: pgsql-general@postgresql.org > Subject: [GENERAL] INSERT or UPDATE > > I have

Re: [GENERAL] INSERT or UPDATE TRIGGER

2009-04-07 Thread James B. Byrne
On Tue, April 7, 2009 16:07, Tom Lane wrote: > > You might find it more useful to add some elog(LOG) statements to > the trigger body. > Thank you again. I will go through section 44.2 tonight. -- *** E-Mail is NOT a SECURE channel *** James B. Byrnemailto:b

Re: [GENERAL] INSERT or UPDATE TRIGGER

2009-04-07 Thread Tom Lane
"James B. Byrne" writes: > I am poking in the dark here. What I want to do is to determine if > the trigger is firing and whether the function works as intended. > At the moment I am not seeing anything show up in the secondary > table so I have done something wrong. Is there some way of gettin

Re: [GENERAL] INSERT or UPDATE TRIGGER

2009-04-07 Thread James B. Byrne
On Tue, April 7, 2009 15:09, Tom Lane wrote: > > ALTER DATABASE foo SET log_min_messages = whatever; > > Note this will only affect subsequently-started sessions. Also, > if memory serves, you have to be superuser to set this particular > variable. Thanks. Am I correct to infer from the output

Re: [GENERAL] INSERT or UPDATE TRIGGER

2009-04-07 Thread Tom Lane
"James B. Byrne" writes: > I am testing the trigger function that I wrote. Is there a way to > increase the logging detail level for just a single database > instance? ALTER DATABASE foo SET log_min_messages = whatever; Note this will only affect subsequently-started sessions. Also, if memory

Re: [GENERAL] INSERT or UPDATE TRIGGER

2009-04-07 Thread Chris Spotts
igger. Like I said, somebody correct me if I'm way off base. Chris -Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of James B. Byrne Sent: Tuesday, April 07, 2009 1:52 PM To: pgsql-general@postgresql.org Subject: Re: [GENER

Re: [GENERAL] INSERT or UPDATE TRIGGER

2009-04-07 Thread James B. Byrne
I am testing the trigger function that I wrote. Is there a way to increase the logging detail level for just a single database instance? The manual indicates not, but just in case I am misreading things I am asking here? -- *** E-Mail is NOT a SECURE channel *** James B. Byrn

Re: [GENERAL] INSERT or UPDATE TRIGGER

2009-04-07 Thread James B. Byrne
This is what I have come up with. Comments are welcomed. CREATE OR REPLACE FUNCTION hll_pg_fn_ident_insert() RETURNS TRIGGER AS $pg_fn$ -- ROW AFTER TRIGGER -- trigger passes identifier_type, _value and _description -- received as ARGV[0], ARGV[1] and ARGV[2]

Re: [GENERAL] INSERT or UPDATE

2009-04-06 Thread Dann Corbit
> -Original Message- > From: James B. Byrne [mailto:byrn...@harte-lyne.ca] > Sent: Monday, April 06, 2009 5:43 PM > To: Dann Corbit > Cc: pgsql-general@postgresql.org > Subject: RE: [GENERAL] INSERT or UPDATE > > > On Mon, April 6, 2009 20:23, Dann Co

Re: [GENERAL] INSERT or UPDATE

2009-04-06 Thread James B. Byrne
On Mon, April 6, 2009 20:23, Dann Corbit wrote: > > If a transaction involves rows where some succeed and some fail, > all will roll back. If that is the desired behavior, or if all > operations are singleton, then you won't see any problems. > Do I understand correctly that this means that even

Re: [GENERAL] INSERT or UPDATE

2009-04-06 Thread Dann Corbit
> -Original Message- > From: James B. Byrne [mailto:byrn...@harte-lyne.ca] > Sent: Monday, April 06, 2009 5:16 PM > To: Dann Corbit > Cc: pgsql-general@postgresql.org > Subject: RE: [GENERAL] INSERT or UPDATE > > > On Mon, April 6, 2009 17:15, Dann Corbit wrot

Re: [GENERAL] INSERT or UPDATE

2009-04-06 Thread James B. Byrne
On Mon, April 6, 2009 17:15, Dann Corbit wrote: > > The pedagogic solution for this type of problem is called merge. > The last I knew, PostgreSQL did not directly support merge. > So you can accomplish the same thing in two stages: > 1. Check for existence and perform an update if the key is pre

Re: [GENERAL] INSERT or UPDATE

2009-04-06 Thread Thomas Kellerer
Dann Corbit wrote on 06.04.2009 23:15: I guess that for some collisions, sharing the name is OK. I failed to explicitly state what the PK looked like. entity_id(entities.id) + identifier_type ('AKNA') + identifier_value(entities.common_name) There will only be a PK collision when we att

Re: [GENERAL] INSERT or UPDATE

2009-04-06 Thread Dann Corbit
> -Original Message- > From: James B. Byrne [mailto:byrn...@harte-lyne.ca] > Sent: Monday, April 06, 2009 2:06 PM > To: Dann Corbit > Cc: pgsql-general@postgresql.org > Subject: RE: [GENERAL] INSERT or UPDATE > > On Mon, April 6, 2009 17:00, Dann Corbit wr

Re: [GENERAL] INSERT or UPDATE

2009-04-06 Thread James B. Byrne
On Mon, April 6, 2009 17:00, Dann Corbit wrote: . > > It is a difficult question. > > For instance, there are many possibilities when a collision occurs. > > I guess that for some collisions, sharing the name is OK. > I failed to explicitly state what the PK looked like. entity_id(entities.id)

[GENERAL] INSERT or UPDATE

2009-04-06 Thread James B. Byrne
I have spent the last couple of days reading up on SQL, of which I know very little, and PL/pgSQl, of which I know less. I am trying to decide how best to approach the following requirement. Given a legal name and a common name and associated details, we wish to insert this information into a tab

Re: [GENERAL] INSERT OR UPDATE

2006-01-02 Thread Andrew - Supernews
On 2006-01-03, Tony Wasson <[EMAIL PROTECTED]> wrote: > On 1/2/06, Julian Scarfe <[EMAIL PROTECTED]> wrote: >> I'm keeping config information for an application in a series of related >> tables. I'd like a command that INSERTs data if it's new, or UPDATEs it if >> the key is duplicated. > > A MERG

Re: [GENERAL] INSERT OR UPDATE

2006-01-02 Thread Tony Wasson
On 1/2/06, Julian Scarfe <[EMAIL PROTECTED]> wrote: > I'm keeping config information for an application in a series of related > tables. I'd like a command that INSERTs data if it's new, or UPDATEs it if > the key is duplicated. A MERGE trigger will do exactly what you are asking for. http://arc

Re: [GENERAL] INSERT OR UPDATE

2006-01-02 Thread Guy Rouillier
Julian Scarfe wrote: > I'm keeping config information for an application in a series of > related tables. I'd like a command that INSERTs data if it's new, < or UPDATEs it if the key is duplicated. Write a stored procedure called something like InsertUpdateConfigData. Pick the operation that you

[GENERAL] INSERT OR UPDATE

2006-01-02 Thread Julian Scarfe
I'm keeping config information for an application in a series of related tables. I'd like a command that INSERTs data if it's new, or UPDATEs it if the key is duplicated. Copying the config info from one database to another virgin installation is easy, of course. I can just use pg_dump on the

Re: [GENERAL] INSERT OR UPDATE?

2005-10-10 Thread Jim C. Nasby
Check the TODO, I'm 99% certain it's on there. On Mon, Oct 10, 2005 at 02:02:32PM +0200, Csaba Nagy wrote: > On Mon, 2005-10-10 at 13:34, Lincoln Yeoh wrote: > [snip] > > It's actually quite surprising how many people get this wrong and don't > > realize it (I wonder how many problems are because

Re: [GENERAL] INSERT OR UPDATE?

2005-10-10 Thread Csaba Nagy
On Mon, 2005-10-10 at 13:34, Lincoln Yeoh wrote: [snip] > It's actually quite surprising how many people get this wrong and don't > realize it (I wonder how many problems are because of this). The SQL spec > should have had a PUT/MERGE decades ago. The insert vs update format being > different i

Re: [GENERAL] INSERT OR UPDATE?

2005-10-10 Thread Lincoln Yeoh
Actually I think the uniqueness constraint (due to the primary key) is the one handling it. There's nothing special about that function that will prevent duplicates. Try running it without the primary key specifications in two separate concurrent transactions. Then commit both transactions.

Re: [GENERAL] INSERT OR UPDATE?

2005-10-10 Thread Hannes Dorbath
On 09.10.2005 08:48, andrew wrote: A very usual and smart approach is to use clases in PEAR::DB. Well, IMHO PEAR::DB is one of the worst classes of PEAR. Besides its ugly code it's worth nothing. This is some incomplete "abstraction layer" for kiddies, to make it easy for people coming from s

Re: [GENERAL] INSERT OR UPDATE?

2005-10-09 Thread David Fetter
On Sun, Oct 09, 2005 at 10:10:28AM -0400, Jerry Sievers wrote: > [EMAIL PROTECTED] writes: > > > Hello all, > > > > I am writing an app in PHP that uses a PostGres database. One > > thing i have noticed is that what should/could be a single line of > > SQL code takes about 6 lines of PHP. This

Re: [GENERAL] INSERT OR UPDATE?

2005-10-09 Thread Dean Gibson (DB Administrator)
Try (for simple cases): DELETE FROM my.table WHERE somecondition; INSERT INTO my.table (somefield) VALUES ('$someval'); In complex cases it may be necessary to INSERT the values into a temporary table, which is then used to condition the DELETE before INSERTing the temporary table into your

Re: [GENERAL] INSERT OR UPDATE?

2005-10-09 Thread Gordon Burditt
>I am writing an app in PHP that uses a PostGres database. >One thing i have noticed is that what should/could be a single line of >SQL code takes about 6 lines of PHP. This seem wasteful and redundant >to me. > >Here is a sample of what I'm talking about ($db is a PDO already >defined and created

Re: [GENERAL] INSERT OR UPDATE?

2005-10-09 Thread [EMAIL PROTECTED]
Gordon Burditt wrote: > [...stuff snipped...] > > MySQL permits (but it's not standard, and available in MySQL 4.1.0 > and later): > > INSERT INTO my.table (somefield) VALUES ('$someval') ON DUPLICATE > KEY UPDATE somefield = '$someval'; > > This is very useful for times when you want to count some

[GENERAL] INSERT OR UPDATE?

2005-10-09 Thread smorrey
Hello all, I am writing an app in PHP that uses a PostGres database. One thing i have noticed is that what should/could be a single line of SQL code takes about 6 lines of PHP. This seem wasteful and redundant to me. Here is a sample of what I'm talking about ($db is a PDO already defined and cr

Re: [GENERAL] INSERT OR UPDATE?

2005-10-09 Thread andrew
I think is almost the same that in many other languages, and like in many other with the time you can have function's libraries, or more likely class libraries with the usefull stuff. In desktop programming environments you have components, here you have classes that are the same thing using it in

Re: [GENERAL] INSERT OR UPDATE?

2005-10-09 Thread Jerry Sievers
[EMAIL PROTECTED] writes: > Hello all, > > I am writing an app in PHP that uses a PostGres database. > One thing i have noticed is that what should/could be a single line of > SQL code takes about 6 lines of PHP. This seem wasteful and redundant > to me. Here ya go!... create temp table foo (

Re: [GENERAL] INSERT OR UPDATE?

2005-10-09 Thread Jerry Sievers
[EMAIL PROTECTED] writes: > Hello all, > > I am writing an app in PHP that uses a PostGres database. > One thing i have noticed is that what should/could be a single line of > SQL code takes about 6 lines of PHP. This seem wasteful and redundant > to me. > > Here is a sample of what I'm talking

Re: [GENERAL] Insert Or update

2004-04-23 Thread Igor Shevchenko
On Saturday 24 April 2004 00:09, you wrote: > And in the proper way to do this in a relational database, those rows > are locked by the application until the user presses the OK button. This kind of change is very rare and is usually done by "admin" user. There's no need to lock those rows betwee

Re: [GENERAL] Insert Or update

2004-04-23 Thread Bruno Wolff III
On Fri, Apr 23, 2004 at 20:17:10 +0300, Igor Shevchenko <[EMAIL PROTECTED]> wrote: > > This workaround is ok but it requires additional programming instead of a > simple single query. Absence of this sort of thing moves some of naturally > database-side logic off to the application, and this s

Re: [GENERAL] Insert Or update

2004-04-23 Thread Igor Shevchenko
On Friday 23 April 2004 20:41, Bruno Wolff III wrote: > I suspect most of the people doing this have something wrong with their > design in the first place. Not really. Here's a simple example. I have a set of mailboxes and I needed to implement a gui widget to assign/remove them to/from a works

Re: [GENERAL] Insert Or update

2004-04-23 Thread Greg Stark
Bruno Wolff III <[EMAIL PROTECTED]> writes: > This was discussed on the list over the last couple of days. > There is no update or insert statement in postgres. > You can do an update and check the number of rows affected and if it > is 0 do the insert. I prefer to do the insert and if it fails

Re: [GENERAL] Insert Or update

2004-04-23 Thread Igor Shevchenko
On Friday 23 April 2004 17:53, Bas Scheffers wrote: > What do you need to do more of, inserts or updates? If the answer is > updates, just do an update and then check for the number of rows affected. > If it is 0, follow it with an insert, if not, you are done. > > You could do this in a stored pro

Re: [GENERAL] Insert Or update

2004-04-23 Thread Bas Scheffers
What do you need to do more of, inserts or updates? If the answer is updates, just do an update and then check for the number of rows affected. If it is 0, follow it with an insert, if not, you are done. You could do this in a stored procedure to save you the round trip of data between the DB and

Re: [GENERAL] Insert Or update

2004-04-23 Thread Bruno Wolff III
On Fri, Apr 23, 2004 at 17:48:21 +0400, Anton Nikiforov <[EMAIL PROTECTED]> wrote: > I know that this will be helpful to write a function that will do this > for me, but it will run the same time as my insertion tool that is > written in c or even slower. So my question is: is it possible to ha

[GENERAL] Insert Or update

2004-04-23 Thread Anton Nikiforov
Dear All, I have a database which stores traffic data and to update the traffic for the particular IP i have to select this ip from the table for this period and if it is already in the database i should run an update statement, but if it is not presented - i should insert the data. It was OK w