joining an array with a table or...? - Mailing list pgsql-general

From Ivan Sergio Borgonovo
Subject joining an array with a table or...?
Date
Msg-id 20091026141526.4d0094ba@dawn.webthatworks.it
Whole thread Raw
Responses Re: joining an array with a table or...?
List pgsql-general
I've a list of emails and a list of users (with emails).

If the list of emails was already inside a table

create table mails (
 mail varchar(64)
);

create table users (
  name varchar(127),
  mail varchar(64)
);

I'd do:
select coalesce(u.mail, m.mail) from mails left join users on
u.mail=m.mail;

Now mails are into a php array and they may be in the range of 5000
but generally less.

The final query will be something like
insert into mailqueue (qid, uid, mail, ...) select ...

and since some fields are pseudo random sequences computed from a
serial, it would be "clean" to do it just in one query.

Any clean technique?

thanks

--
Ivan Sergio Borgonovo
http://www.webthatworks.it


pgsql-general by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: cursor MOVE vs OFFSET in SELECT
Next
From: Raymond O'Donnell
Date:
Subject: Re: [ANNOUNCE] [pgeu-general] PGDay.EU 2009 - approaching fast!