[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 a path from textbox...

2010-05-31 Thread Alban Hertroys
On 31 May 2010, at 23:27, david.cata...@1as.es 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.

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 spent the last couple of days

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 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 this

Re: [GENERAL] INSERT or UPDATE TRIGGER

2009-04-07 Thread Chris Spotts
. 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: [GENERAL] INSERT

Re: [GENERAL] INSERT or UPDATE TRIGGER

2009-04-07 Thread Tom Lane
James B. Byrne byrn...@harte-lyne.ca 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

Re: [GENERAL] INSERT or UPDATE TRIGGER

2009-04-07 Thread Tom Lane
James B. Byrne byrn...@harte-lyne.ca 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.

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.

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. Byrne

[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

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) +

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 wrote: . It is a difficult question

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

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 present

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 wrote: The pedagogic solution

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 if

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 Corbit wrote: If a transaction involves

[GENERAL] Insert vs Update syntax

2008-02-29 Thread Clodoaldo
When inserting into a table and there are many columns to be inserted it is hard to synchronize columns to values: insert into my_table ( a, b, c, ...many more columns )values( @a, @b, @c, ... the corresponding values ) Is there

Re: [GENERAL] Insert vs Update syntax

2008-02-29 Thread Clodoaldo
2008/2/29, Martijn van Oosterhout [EMAIL PROTECTED]: On Fri, Feb 29, 2008 at 01:17:20PM -0300, Clodoaldo wrote: When inserting into a table and there are many columns to be inserted it is hard to synchronize columns to values: snip Is there some reason for the insert syntax to be

Re: [GENERAL] Insert vs Update syntax

2008-02-29 Thread Martijn van Oosterhout
On Fri, Feb 29, 2008 at 01:17:20PM -0300, Clodoaldo wrote: When inserting into a table and there are many columns to be inserted it is hard to synchronize columns to values: snip Is there some reason for the insert syntax to be the way it is in instead of the much easier to get it right

Re: [GENERAL] Insert vs Update syntax

2008-02-29 Thread Brent Friedman
If you don't like the standard sql implementation, you could use plsql or any language to make an abstraction layer/wrapper for this functionality. Just pass everything as a key/value pair, in an array or hashtable structure, to your abstraction layer/wrapper, and it can cycle through the

Re: [GENERAL] Insert vs Update syntax

2008-02-29 Thread Clodoaldo
2008/2/29, Brent Friedman [EMAIL PROTECTED]: If you don't like the standard sql implementation, you could use plsql or any language to make an abstraction layer/wrapper for this functionality. Just pass everything as a key/value pair, in an array or hashtable structure, to your abstraction

Re: [GENERAL] Insert vs Update syntax

2008-02-29 Thread Kaloyan Iliev
Hi, I've solved this problem for me (Perl). I have a module DBAPI and write a function InsertIntoTable($table_name, $hash_with_values, $data_base_handler). I send the parms to the function in the hash (key1 = value1, key2 = value2 ...) and in the function I compose the insert and execute it.

Re: [GENERAL] Insert vs Update syntax

2008-02-29 Thread Richard Huxton
Clodoaldo wrote: 2008/2/29, Brent Friedman [EMAIL PROTECTED]: If you don't like the standard sql implementation, you could use plsql or any language to make an abstraction layer/wrapper for this functionality. Just pass everything as a key/value pair, in an array or hashtable structure, to

[GENERAL] INSERT before UPDATE?

2007-08-16 Thread Jiří Němec
Hello, I would like to ask you for an advice. There are two tables in my PostgreSQL database - main table with datas and second with translations for all languages of these records. When I try to UPDATE a record in the language table and this record doesn't exists there I need to INSERT into

Re: [GENERAL] INSERT before UPDATE?

2007-08-16 Thread A. Kretschmer
am Thu, dem 16.08.2007, um 10:30:01 +0200 mailte Ji?í N?mec folgendes: Hello, I would like to ask you for an advice. There are two tables in my PostgreSQL database - main table with datas and second with translations for all languages of these records. When I try to UPDATE a record in

Re: [GENERAL] INSERT before UPDATE?

2007-08-16 Thread A. Kretschmer
am Thu, dem 16.08.2007, um 14:11:07 +0200 mailte Ji??í N??mec folgendes: see http://www.postgresql.org/docs/current/static/plpgsql-control-structures.html#PLPGSQL-UPSERT-EXAMPLE Yes I see, but I'll try to describe it in more detail: I could write plpgsql trigger function which will

[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

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

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.

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 MERGE trigger

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

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 of

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 about

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 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

[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

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 something

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 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 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 seem

[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

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 have

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 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

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 due

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

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 sounds

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 between