[SQL] How To Get Bytea Data Instead Of Its Oid

2002-09-19 Thread CN LIOU

Greetings!

I must have missed lesson 1 of postgresql!

create table test (c1 text,c2 bytea);

Then, I probably have successfullyi nserted several records into test using 
C++Builder. Now I am trying to retrieve back the binary data in c2 I just inserted. 
However, the SQL statement issued by both C++Builder and psql:

SELECT * FROM test LIMIT 1

returns, I guess, the OID of c2 instead of the binary data to which the OID points. 

What is the correct SQL syntax for C++Builder for bytea?

Regards,
-- 
___
Get your free email from http://www.graffiti.net

Powered by Outblaze

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



[SQL] Two Permance Questions

2002-09-19 Thread CN LIOU

Hi!

Q1. Is subquery better or join?

For subquery:

SELECT t1.c1,(SELECT t2.c2 FROM t2 WHERE t2.c1 = t1.c1) FROM t1

I wonder it will loop n times if t1 returns n rows. If this is the case, is it better 
to use join like this:

SELECT t1.c1,t2.c2 FROM t1,t2 WHERE t2.c1 = t1.c1

Q2. If the query is not optimize like this:

SELECT t1.c1,t2.c2 FROM t1,t2,t1,t2,t2 WHERE t2.c1=t1.c1 AND t1.c1=t2.c1 AND 
t1.c1=t2.c1

and the size of this clause can soar up to several kbytes, then can this query cause 
performance problem?

Regards,
-- 
___
Get your free email from http://www.graffiti.net

Powered by Outblaze

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster