[SQL] Updating two table via a Rule?
How do I create a rule for a view that inserts into two tables? I have a view based on two tables. I would like to create insert, update, and delete rules for this view to: - update both tables when the view is updated - delete from both tables when a record is deleted from the view - insert into both table when a record is inserted into the view Here is the view: CREATE VIEW reg_PaymentLines AS SELECT P.MemberID, P.PaymentsID, P.PaymentDate, PL.PaymentLineID, PL.PaymentTypesID, PL.Amount FROM Payments P, PaymentLines PL WHERE P.PaymentsID = PL.PaymentsID; I have tried to create two insert rules on the view as follows: CREATE RULE reg_PaymentLines_r1 AS ON INSERT TO reg_PaymentLines DO INSTEAD INSERT INTO PaymentLines (PaymentsID, PaymentLineID, Amount) VALUES (new.PaymentsID, new.PaymentLineID, new.Amount); CREATE RULE reg_PaymentLines_r2 AS ON INSERT TO reg_PaymentLines DO INSTEAD INSERT INTO Payments (MemberID, PaymentsID, PaymentDate, Amount) VALUES (new.MemberID, new.PaymentsID, new.PaymentDate, new.Amount); PostgreSQL allows me to create the two rules. However, when I insert into the view, I get a foreign key constraint violation because the PaymentID does not exist in the Payments table. There is a foreign key constraint from PaymentLines.PaymentsID to Payments.PaymentsID. It appears that either: - the insert into the PaymentLines table before the insert occurs in the Payments tables - or that the insert into the PaymentLines table is not aware of the insert into the Payments table. - or that the insert to the Payments table is being ignored I get the same error regardless of how the two rules are created (i.e. same error if rule #2 is applied before rule #1). Any suggestions on how to get this to work? Any help is greatly appreciated. Thanks, Michael Davis
[SQL] RE: Updating two table via a Rule?
I just answered my question. For anyone how may be interested, here is the
answer. The following create rule allows multiple actions. This was not
very clear from the documentation. Would some be willing to suggest to the
documentation group to add an example of a rule with multiple actions? I
stumbled onto this syntax in an email on the hacker list after several
hours of research.
CREATE RULE reg_PaymentLines_r1 AS ON INSERT TO reg_PaymentLines
DO INSTEAD (
INSERT INTO Payments (MemberID, PaymentsID, PaymentDate,
Amount)
VALUES (new.MemberID, new.PaymentsID, new.PaymentDate,
new.Amount);
INSERT INTO PaymentLines (MemberID, PaymentsID, PaymentLineID,
Amount)
VALUES (new.MemberID, new.PaymentsID,
new.PaymentLineID, new.Amount);
);
Here is an insert that works:
insert into reg_PaymentLines (MemberID, PaymentsID, PaymentDate,
PaymentLineID, Amount)
VALUES(9, 77,
'1/1/2001', nextval('PaymentLines_s'), 10);
Here is the insert that is failing:
insert into reg_PaymentLines (MemberID, PaymentsID, PaymentDate,
PaymentLineID, Amount)
VALUES(9, nextval('Payments_s'), '1/1/2001',
nextval('PaymentLines_s'), 10);
The Payments_s sequences is bumped on both inserts. As a result, the
insert into the PaymentLines table has a different PaymentsID that the
insert into the Payments table.
Thanks, Michael Davis
-Original Message-
From: Michael Davis [SMTP:[EMAIL PROTECTED]]
Sent: Monday, January 01, 2001 3:20 AM
To: PostgreSQL-SQL
Subject:Updating two table via a Rule?
How do I create a rule for a view that inserts into two tables?
I have a view based on two tables. I would like to create insert, update,
and delete rules for this view to:
- update both tables when the view is updated
- delete from both tables when a record is deleted from the view
- insert into both table when a record is inserted into the view
Here is the view:
CREATE VIEW reg_PaymentLines AS
SELECT P.MemberID, P.PaymentsID, P.PaymentDate,
PL.PaymentLineID, PL.PaymentTypesID, PL.Amount
FROM Payments P, PaymentLines PL
WHERE P.PaymentsID = PL.PaymentsID;
I have tried to create two insert rules on the view as follows:
CREATE RULE reg_PaymentLines_r1 AS ON INSERT TO reg_PaymentLines
DO INSTEAD
INSERT INTO PaymentLines (PaymentsID, PaymentLineID, Amount)
VALUES (new.PaymentsID, new.PaymentLineID,
new.Amount);
CREATE RULE reg_PaymentLines_r2 AS ON INSERT TO reg_PaymentLines
DO INSTEAD
INSERT INTO Payments (MemberID, PaymentsID, PaymentDate,
Amount)
VALUES (new.MemberID, new.PaymentsID, new.PaymentDate,
new.Amount);
PostgreSQL allows me to create the two rules. However, when I insert into
the view, I get a foreign key constraint violation because the PaymentID
does not exist in the Payments table. There is a foreign key constraint
from PaymentLines.PaymentsID to Payments.PaymentsID. It appears that
either:
- the insert into the PaymentLines table before the insert occurs in the
Payments tables
- or that the insert into the PaymentLines table is not aware of the insert
into the Payments table.
- or that the insert to the Payments table is being ignored
I get the same error regardless of how the two rules are created (i.e. same
error if rule #2 is applied before rule #1).
Any suggestions on how to get this to work? Any help is greatly
appreciated.
Thanks, Michael Davis
[SQL] Removing a constraint?
Does anyone know how to completely and accurately remove or drop a constraint, specifically a foreign key constraint? I tried to remove a constraint by deleting it's trigger from pg_triggers. This caused some undesirable side effects with other tables involved with the constraint. I have several tables that I need to change the column constraints and foreign key constraints on. Recreating (drop and create) the table every time I need to change a column constraint is a pain because all the objects that reference the table would also need to be recreated (i.e. views and triggers). How do production DBAs successfully make changes to their tables? FYI, I was able to alter table add the same constraint many times. Is this a problem? This created a new trigger in pg_triggers every time.
[SQL] Numeric and money
Hello Everyone, I am in the process of migrating my Access97 application to PostgreSQL. So far everything looks great with one exception. I converted my currency fields in Access to numeric(9,2) as recommended in the PostgreSQL documentation. Many things to don't play well with the numeric the data type. Here are some examples: create table tst (id int, amount numeric(9,2)); insert into tst values (1, 1.10); insert into tst values (2, 1.00); insert into tst values (2, 2.00); select * from tst where amount = 1; -- works select * from tst where amount = 1.1; -- fails select * from tst where amount = 1.10; -- fails select amount::varchar from tst; -- fails select amount::money from tst; -- fails select id || ', ' || id from tst; -- works select id || ', ' || amount from tst; -- fails >From within Access, I can't update any table with a numeric data type because of the "select * from tst where amount = 1.1;" failure. These limitations have caused me to wonder what other PostgreSQL users are using for their money values? Is numeric(9,2) the best choice for money? I think that adding numeric to text and text to numeric operators will fix most of these issues. I plan to add these operators very soon and thought I would ask if anyone has done this before and could provide me an example or two before I start. Does anyone know of any internal functions that already exist to convert numeric to text so that I don't have to write one? I know that psql successfully does this. Thanks, Michael Davis Database Architect and Senior Software Engineer, Seva Inc. Office: 303-460-7360Fax: 303-460-7362 Mobile: 720-320-6971 Email: [EMAIL PROTECTED]
[SQL] RE: Joining several tables
1) Select t1.* from table_1 t1, table2 t2 where t1.column = t2.column; 2) Select t1.* from table_1 t1 join table2 t2 on t1.column = t2.column; -Original Message- From: Stephan Richter [SMTP:[EMAIL PROTECTED]] Sent: Sunday, January 21, 2001 11:20 PM To: [EMAIL PROTECTED] Subject:Joining several tables Hello, I have the following situation: I have an Address, PhoneNumber and Contact table all having a contactid in common, but sometimes the phone number does not exist. I want to join these three tables. How do I do that? I could not find the syntax for multiple tables... Regards, Stephan -- Stephan Richter CBU - Physics and Chemistry Student Web2k - Web Design/Development & Technical Project Management
[SQL] RE: retrieving user's groups
Here's a start: select g.groname as group, g.grosysid as group_id, u.usename as user, u.usesysid as user_id from pg_group g, pg_user u where u.usesysid = g.grolist[1] or u.usesysid = g.grolist[2] or u.usesysid = g.grolist[3] or u.usesysid = g.grolist[4] or u.usesysid = g.grolist[5] or u.usesysid = g.grolist[6] or u.usesysid = g.grolist[7] or u.usesysid = g.grolist[8] or u.usesysid = g.grolist[9] or u.usesysid = g.grolist[10] order by groname, usename; -Original Message- From: chard [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, January 23, 2001 7:39 PM To: [EMAIL PROTECTED] Subject:retrieving user's groups hello, how will i retrieve group names of a certain user? using sql. richard
[SQL] RE: DATE
Select now() + 7; -Original Message- From: john whale [SMTP:[EMAIL PROTECTED]] Sent: Monday, January 22, 2001 10:30 AM To: '[EMAIL PROTECTED]' Subject:DATE PLEASE ADVISE HOW I SHOULD ALTER THE COMMAND: <$NOW;DD;> TO GIVE ME A DATE THAT IS X DAYS FORWARD ie: I WISH TO REPRESENT A DATE IN FORM WHICH IS A 7 DAYS FORWARD OF THE DATE NOW. REGARDS JOHN WHALE
[SQL] RE: plpgsql language
Did you execute the following after you created your database? CREATE FUNCTION plpgsql_call_handler () RETURNS OPAQUE AS '/usr/local/pgsql/lib/plpgsql.so' LANGUAGE 'C'; CREATE TRUSTED PROCEDURAL LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL'; These are needed for the plpgsql language to work. -Original Message- From: chard [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, January 23, 2001 10:40 PM To: [EMAIL PROTECTED] Subject:plpgsql language hello, i got this error when i tried to create a function "unrecognized language specified in CREATE FUNCTION: 'plpgsql'" why is that?
[SQL] RE: SQL Query Results
In psql you can try \g or \o. -Original Message- From:[SMTP:[EMAIL PROTECTED]] Sent: Tuesday, January 23, 2001 10:03 PM To: [EMAIL PROTECTED] Subject:SQL Query Results I want to show a certain person the commands I type and the query results, and I want to save them in a file. I tried \e filename and \E filename and its not working. Can someone please help me??
[SQL] RE: Is there anything like DESCRIBE?
This works for me: SELECT DISTINCT c.relname as table_name, a.attname as column_name, t.typname, pa.adsrc as default FROM (pg_attribute a join pg_class c on a.attrelid = c.oid join pg_type t on a.atttypid = t.oid) left join pg_attrdef pa on c.oid = pa.adrelid AND a.attnum = pa.adnum where exists (select * from pg_tables where tablename = c.relname and substr(tablename,1,2) <> 'pg') order by c.relname, a.attname; -Original Message- From: Mike D'Agosta [SMTP:[EMAIL PROTECTED]] Sent: Wednesday, January 24, 2001 12:01 PM To: [EMAIL PROTECTED] Subject:Is there anything like DESCRIBE? Hi, I have a number of empty tables and I want to get the column names and data types with an SQL statement. I want to do this procedurally, not interactively (so I can't use \d in psql). Postgres doesn't support DESCRIBE... is there any other way to do this? Thanks! Mike
[SQL] RE: looping through results of a SELECT
Try using aggregate functions. Creating your own aggregate function is fairly easy and can produce the exact results you are looking for. In case this is not good enough, here is an example of some code I used to loop through rows in a table in pl/pgsql CREATE FUNCTION pending_post_transaction(int) RETURNS int AS ' DECLARE pMemberID ALIAS for $1; plrecord; rcint; BEGIN if (pMemberID is null) then RAISE NOTICE ''MemberID is null''; return 0; end if; select count(*) into rc from Pending P where P.MemberID = pMemberID; if (rc > 0) then else RAISE NOTICE ''No rows to process''; return 0; end if; FOR pl IN select * from Pending where MemberID = pMemberID LOOP if (pl.InventoryID > 0) then -- InventoryID is a column in the Pending table ... else RAISE NOTICE "The InventoryID is empty, skipping the update"; return 0; end if; if (pl.SpecialArrangement >= 0) then -- SpecialArrangement is also a column in the Pending table ... end if; END LOOP; return rc; END;' LANGUAGE 'plpgsql'; -Original Message- From: Nagy Tamas [SMTP:[EMAIL PROTECTED]] Sent: Saturday, January 27, 2001 12:16 PM To: [EMAIL PROTECTED] Subject:looping through results of a SELECT Hello! I'd like to write a function, that makes some calculations (perhaps applies another function) on every row of a result set returned by a SELECT query. I thought writing a WHILE loop would work, but I couldn't assign the individual rows to a variable. Then, I read about the FETCH command, and I tried to use that, but it dies with 'error near CURSOR' error when I try to use the function. I wrote a PL/PGSQL function, obviously. So, my question is: is there an easy way to assign the individual rows of a SELECT result to a variable in a function? Thanks in advance, Thomas Nagy
[SQL] RE: Rownum/ row Id
The column name is OID. -Original Message- From: Padmajha Raghunathan [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, January 30, 2001 11:20 PM To: [EMAIL PROTECTED] Subject:Rownum/ row Id Hi, Is there a provision to delete the duplicate records using row num/ row id as available in Oracle??? Thanx in advance padmajha
[SQL] RE: no value for numeric filed in SQL statement causes an error
Try:
insert into table (name,id,city) values ('roger rabbit',NULL,'carrot city')
-Original Message-
From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
Sent: Wednesday, January 31, 2001 7:16 AM
To: [EMAIL PROTECTED]
Subject:no value for numeric filed in SQL statement causes an error
Hi there
I have a table with char and int fields. From my form I get no values back
for int fields when they are left blank. This causes the SQL insert to
fail.
field type
name char
id int2
city char
insert into table (name,id,city) values ('roger rabbit',,'carrot city')
The default for int/float fields is 0. Since I reuse the code of the
referring page I don't like to have all fields assigned 0 at the beginning.
Who can help ???
Thanks ... jr
PFISTER + PARTNER, SYSTEM - ENGINEERING AG
Juerg Rietmann
Grundstrasse 22a
6343 Rotkreuz
Switzerland
phone: +4141 790 4040
fax: +4141 790 2545
mobile: +4179 211 0315
[SQL] RE: how to create this trigger?
Did you insert a row into table2? What happens if there is no row in table 1 where id = code (of the newly inserted row in table2). Seems to me you many need to consider expanding increment_value() to check table1 to see if code exists. If not insert a new value, else update. -Original Message- From: Ramiro Arenas Ramirez [SMTP:[EMAIL PROTECTED]] Sent: Thursday, February 01, 2001 2:48 PM To: [EMAIL PROTECTED] Subject:how to create this trigger? I need to create a trigger that increment a value in a column of table1 where a row is inserted in table 2 I have tried whit this but it just does nothing. CREATE FUNCTION increment_value () RETURNS opaque AS 'DECLARE code int4; BEGIN code := new.code; UPDATE table1 SET value = value + 1 WHERE id = code; RETURN NEW; END;' LANGUAGE 'plpgsql'; CREATE TRIGGER insert_on_table2 BEFORE INSERT ON table2 FOR EACH ROW EXECUTE PROCEDURE increment_value(); Can you help me?
[SQL] RE: C function for use from PLpgSQL trigger
You could send the column name directly into your c function. For example: c_function_name(NEW.col1, NEW.col2, NEW.col3). Otherwise I am not sure how to send NEW into a C function. You could try declaring NEW in your C function as a tuple. -Original Message- From: Joe Conway [SMTP:[EMAIL PROTECTED]] Sent: Sunday, February 04, 2001 1:04 AM To: [EMAIL PROTECTED] Subject:Fw: C function for use from PLpgSQL trigger Hello all, I posted this (see below) Friday to the interfaces list with no response. Does anyone know if what I'm trying to do is possible, or should I just write the entire thing in a C function trigger? The latter would be unfortunate because I think it would be nice to be able to extend PLpgSQL using C functions like this. Anyway, any help or advice will be much appreciated! Thanks, Joe > Hi, > > I'm trying to create a C function that I can call from within a PLpgSQL > trigger function which will return a list of all the values in the NEW > record formatted suitably for an insert statement. I can't come up with a > way to do this directly from within PLpgSQL (i.e. iterate through an > arbitrary number of NEW.attribute). > > Can anyone tell me how I can either pass the NEW record to the C function > (this produces an error message 'NEW used in a non-rule query') or gain > access to the trigger tuple from within my C function? It seems that > although PLpgSQL is called as a trigger, the C function is called as a > regular function (makes sense) and thus has no access to the trigger tuple > (my problem). > > Any help or guidance is greatly appreciated! > > Thanks, > > Joe Conway >
[SQL] RE: Hrm...why is this wrong?
When declaring parameters try using varchar rather than varchar(255). I have used
text successfully in the past.
-Original Message-
From: Ken Corey [SMTP:[EMAIL PROTECTED]]
Sent: Sunday, February 04, 2001 6:38 AM
To: [EMAIL PROTECTED]
Subject:Hrm...why is this wrong?
In trying to use a plpgsql stored proc, I'm getting an error I don't
understand.
When the select at the bottom of this email is executed, I'm getting the
message:
ERROR: parser: parse error at or near "$1"
Any ideas?
--
Ken Corey, CTOAtomic Interactive, Ltd.
select 'drop FUNCTION IU_EMPLOYEE(varchar(255), ...);' as Progress;
drop FUNCTION IU_EMPLOYEE( varchar(255), varchar(255),
varchar(255), varchar(255), varchar(255), varchar(255),
varchar(255), varchar(255), varchar(255), varchar(255),
varchar(255));
select 'create FUNCTION IU_EMPLOYEE(varchar(255), ...)' as Progress;
create FUNCTION IU_EMPLOYEE( varchar(255), varchar(255),
varchar(255), varchar(255), varchar(255), varchar(255),
varchar(255), varchar(255), varchar(255), varchar(255),
varchar(255))
RETURNS INT4
AS '
DECLARE
user_name_in alias for $1;
passwd_in alias for $2;
firstname_in alias for $3;
lastname_in alias for $4;
company_in alias for $5;
addr1_in alias for $6;
addr2_in alias for $7;
city_in alias for $8;
state_in alias for $9;
postcode_in alias for $10;
country_in alias for $11;
userid_calc INT4;
companyid_calc INT4;
BEGIN
userid_calc := 0;
select into companyid_calc COMPANY_ID from COMPANY
where COMPANY_NAME = company_in;
if (companyid_calc is null)
then
insert into COMPANY (COMPANY_NAME) values (company_in);
companyid_calc := currval(''company_company_id_seq'');
end if;
if (companyid_calc is not null)
then
insert into EMPLOYEE ( COMPANY_ID ,
AUTHORIZED , RIGHTS , USERNAME , PASSWD , FIRSTNAME ,
LASTNAME , ADDR1 , ADDR2 , CITY , STATE , POSTCODE ,
COUNTRY)
values (
companyid_calc,0,0,username_in, password_in, firstname_in,
lastname_in, company_in,addr1_in,addr2_in,city_in,
state_in,postcode_in,country_in
);
userid_calc := currval(''employee_employee_id_seq'');
else
rollback;
return 0;
end if;
return userid_calc;
END;'
LANGUAGE 'plpgsql';
select iu_employee('handtest','password','hand','test','handcompany',
'handaddr','handaddr2','handcity','handstate','handpostcode','handcountry');
[SQL] RE: plpgsql error: cache lookup from pg_proc failed
Setting NEW in an AFTER update or insert trigger is not wise. Try using a before update trigger instead. -Original Message- From: Joseph Shraibman [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, February 06, 2001 6:35 PM To: [EMAIL PROTECTED] Subject:plpgsql error: cache lookup from pg_proc failed playpen=# create table aa( playpen(# a int, playpen(# b int, playpen(# t timestamp playpen(# ); CREATE playpen=# playpen=# playpen=# CREATE FUNCTION touch () RETURNS OPAQUE AS ' playpen'# BEGIN playpen'# new.t := current_timestamp; playpen'# RETURN new; playpen'# END; playpen'# ' LANGUAGE 'plpgsql'; CREATE playpen=# playpen=# playpen=# CREATE TRIGGER lastmod_1 AFTER update or insert ON aa FOR EACH ROW EXECUTE PROCEDURE touch(); CREATE playpen=# insert into aa (a, b) values (1,2); ERROR: plpgsql: cache lookup from pg_proc failed What does this error message mean? -- Joseph Shraibman [EMAIL PROTECTED] Increase signal to noise ratio. http://www.targabot.com
[SQL] Access tables inside pl/pgsql functions
I would like to create a pl/pgsql function that can select from a table even though users can't select from the table directly. For example, create a table and function that hits the table as the postgres user. Log in as another user and select function_name();. This fails because the user does not have permissions to select from the table. The issues is that I don't want the users to be able to select from the table but I would like to allow the user to call a stored procedure than can select from the table. Any idea how to do this? Any help is greatly appreciated. Thanks, Michael Here is an example. Create the following table and function as the postgres user: CREATE TABLE tst ( tmp_relname name, id smallint ); CREATE FUNCTION test() RETURNS int AS ' BEGIN DELETE FROM tst; return 1; END;' LANGUAGE 'plpgsql'; Login as another user Select test(); -- this will fail ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
[SQL] RE: Help with UPDATE syntax
Try eliminating the statement " from user_group_map map". It does not belong in the update. Here is the fully rewritten statement: update user_group_map set user_id = 4 where user_id = 9 and not exists ( select * from user_group_map ug2 where user_id = 4 and ug2.group_id = map.group_id and ug2.role = map.role); -Original Message- From: Jeff Putsch [SMTP:[EMAIL PROTECTED]] Sent: Wednesday, March 14, 2001 11:47 PM To: [EMAIL PROTECTED] Subject:Help with UPDATE syntax Howdy, I am porting a bit of code from ORACLE to PostgreSQL 7.1 and am getting stuck on an update statment. I am NOT a SQL expert, merely a beginner swimming hard, so any help will be greatly appreciated. The specific query looks like this: begin transaction update user_group_map map set user_id = 4 where user_id = 9 not exists ( select * from user_group_map where user_id = 4 and group_id = map.group_id and role = map.role ) commit There are other updates taking place during the transaction, but this is the one for which I can't figure out the PostgreSQL equivalent. I've tried this: update user_group_map set user_id = 4 from user_group_map map where user_id = 9 and not exists ( select * from user_group_map ug2 where user_id = 4 and ug2.group_id = map.group_id and ug2.role = map.role); for the update replacement, but get an error: NOTICE: current transaction is aborted, queries ignored until end of transaction block As noted earlier, any guidance will be most appreciated. Thanks, Jeff. ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
[SQL] RE: Oracle to PostgreSQL help: What is (+) in Oracle select?
This is Oracle's syntax for an outer join. Try this in PostgreSQL SELECT o.* from one o LEFT JOIN two t ON o.key = t.key; -Original Message- From: Christopher Audley [SMTP:[EMAIL PROTECTED]] Sent: Friday, March 16, 2001 3:57 PM To: [EMAIL PROTECTED] Subject:Oracle to PostgreSQL help: What is (+) in Oracle select? I'm trying to modify an application which runs on Oracle to run against PostgreSQL. I'm currently stuck on a query that I can't recognize, it doesn't look like standard SQL. A select is done across two tables, however when joining the foreign key, the right hand side of the equallity has (+) appended SELECT o.* from one o, two t where o.key = t.key(+) Does anyone know what this does and how I can reproduce the select in PostgreSQL? Thanks Chris ---(end of broadcast)--- TIP 3: 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 ---(end of broadcast)--- TIP 3: 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]
Try: Create table table1(field1,field2) as (select field1, field2 from table2); -Original Message- From: Joseph Syjuco [SMTP:[EMAIL PROTECTED]] Sent: Monday, September 03, 2001 3:03 AM To: [EMAIL PROTECTED] Subject: im new in postgresql (actually came from SQL Server) and i was trying a script like this insert into table1(field1,field2) values (select field1, field2 from table 2); i dont know if this is possible (inserting a set of entries via resultset from a select stmt in one command). If anyone has any answers, or workarounds pls do email me Thanks ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
