[SQL] how to add an new record from part of an old one
Hi there I need to half copy and insert new data in a new record. Please see the SQL statement, that is not working, but i think is shows what I'd like to do. The fields a_nr and a_kurzbez will get the values from a form and a_bez needs to be copied from an existing auftrag. Thanks for any help ... jr insert into auftrag (a_nr, a_kurzbez) values (123456789, 'testtext') (select a_bez from auftrag where a_nr='200113672732') PFISTER + PARTNER, SYSTEM - ENGINEERING AG Juerg Rietmann Grundstrasse 22a 6343 Rotkreuz Switzerland phone: +4141 790 4040 fax: +4141 790 2545 mobile: +4179 211 0315 ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl
Re: [SQL] how to add an new record from part of an old one
[EMAIL PROTECTED] wrote: Hi there I need to half copy and insert new data in a new record. Please see the SQL statement, that is not working, but i think is shows what I'd like to do. The fields a_nr and a_kurzbez will get the values from a form and a_bez needs to be copied from an existing auftrag. Thanks for any help ... jr insert into auftrag (a_nr, a_kurzbez) values (123456789, 'testtext') (select a_bez from auftrag where a_nr='200113672732') Try something like the folowing example: test=# create table a (id serial, a1 text, a2 int4); CREATE test=# insert into a (a1, a2) values ('1221211', 12); INSERT 580415 1 test=# insert into a (a1, a2) values ('12345', 11); INSERT 580416 1 test=# select * from a; id | a1 | a2 +-+ 1 | 1221211 | 12 2 | 12345 | 11 (2 rows) test=# create table b (id serial, b1 text, b2 int4, b3 varchar(32)); CREATE test=# insert into b (b1, b2, b3) select a1, a2, 'something else' from a where id = 1; INSERT 580468 1 test=# select * from b; id | b1 | b2 | b3 +-++ 1 | 1221211 | 12 | something else (1 row) test=# I hope this can help you !! George Moga, Data Systems Srl Slobozia, ROMANIA
[SQL] Setting session global variables
Is there a way to set a session global variable in PostgreSQL? The only thing I see are examples of setting config variables. Not sure if session variables are your best solution, but here's how you implement them: -- Warning: this defines a global variable in the tcl interpretor. This could -- crash with other TCL procedures if the same name were used during the same connection. -- Store a value in a variable. This is helpful for caching values in a transaction -- Calling sequence: store(variable,value) create function store(text,text) returns int4 as ' global store_vars return [set store_vars($1) $2] ' LANGUAGE 'pltcl'; -- Fetch a value from a variable. -- Calling sequence: recall(variable) create function recall(text) returns int4 as ' global store_vars return [subst $store_vars($1)] ' LANGUAGE 'pltcl'; begin:vcard n:Bateman;Kyle x-mozilla-html:FALSE org:Action Target Inc. adr:;; version:2.1 email;internet:[EMAIL PROTECTED] title:President x-mozilla-cpt:;0 fn:Kyle Bateman end:vcard ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
[SQL] ON UPDATE CASCADE overhead?
If I add ON UPDATE CASCADE to my foreign key definitions, how much will it affect performance for queries that don't trigger the cascade? Cheers, Forest ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
[SQL] has anyone tried running in MAC OS X
I guess the subject line says ithas anyone tried running PostgreSQL in MAC OS X. I see that in the product brochure, Apple specifically mentions Mysql. I run a shop that has all mac computers. I am runnng just 1 linux box (SUSE Linux on a Max G3) to run the job tracking system. Please, I don't want to start a "my Os is better than yours" war. It is just a question Ted ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [SQL] has anyone tried running in MAC OS X
On Thu, May 17, 2001 at 08:48:39PM -0400, postgresql wrote: > I guess the subject line says ithas anyone tried running > PostgreSQL in MAC OS X. Isn't OS X fairly close to NEXTSTEP (or whatever the casing is these days)? How well does PostgreSQL work on NS? Did you try building it yet? :-> mrc -- Mike Castle Life is like a clock: You can work constantly [EMAIL PROTECTED] and be right all the time, or not work at all www.netcom.com/~dalgoda/ and be right at least twice a day. -- mrc We are all of us living in the shadow of Manhattan. -- Watchmen ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl
Re: [SQL] has anyone tried running in MAC OS X
"postgresql" <[EMAIL PROTECTED]> writes: > I guess the subject line says ithas anyone tried running > PostgreSQL in MAC OS X. Some folks at Apple did. Postgres 7.1 is alleged to build out-of-the-box on OSX. (But I haven't tried it myself.) Don't bother trying with earlier releases. regards, tom lane ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl