Re: [SQL] pl/PgSQL: Samples doing UPDATEs ...

2005-08-18 Thread daq
re I could find such (and others, would be great) online? ... execute ''Update ...''; GET DIAGNOSTICS processed_rows = ROW_COUNT; return processed_roows; ... See PostgreSQL 7.3 online documentation 19.5.5. Obtaining result status. http://www.postgresql.org/docs/7.3/i

Re: [SQL] A Table's Primary Key Listing

2005-08-18 Thread daq
ttribute where attrelid=pg_index.indrelid and pg_attribute.attnum=pg_index.indkey[0]) from pg_index where indisprimary and indrelid=(select oid from pg_class where relname='yourtable'); DAQ ---(end of broadcast)--- TIP 4: Have you searched our li

Re: [SQL] [NOVICE] Suspend Referential Integrity?

2005-08-09 Thread daq
pg_class set reltriggers=0 where relname='your_table_name'; To switch back: update pg_class set reltriggers=(select count(*) from pg_triggers where pg_class.oid=tgrelid) where relname='your_table_name'; DAQ ---(end of broadcast)--

Re: [SQL] 'select where' using multiple columns.

2005-08-05 Thread daq
ies if its a FAQ. RK> Rob RK> ---(end of broadcast)--- RK> TIP 5: don't forget to increase your free space map settings Try this way: select * where forename_1||' '||forename_2||' '||surname like '%String%' or s

Re: [SQL] [NOVICE] SQL error code -601

2005-08-03 Thread daq
ere a major problem at this point? jcafg> Thanks in advance!! A query failed inside a transaction. All other DML query inside this transaction skipped. DAQ ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [SQL] [NOVICE] Make year 01/01/0001 but leave timestamp alone

2005-08-02 Thread daq
ing through the various date time functions but don't see a WJS> simple way to do this. Can someone help? WJS> Thanks, WJS> Jed Maybe... Chomp the date part and concatenate the timestamp with '01/01/0001' DAQ ---(end of broadcas

Re: [SQL] CREATE TABLE AS SELECT

2005-07-29 Thread daq
JB> Offered up because I have no explanation, and curiosity overwhelms me: JB> I was attempting to create a table from a SELECT statement against JB> another table: JB> create table foo JB> as select JB> a, JB> f(b) JB> from xxx; In this command table foo populated after the select statement

Re: [SQL] Create trigger for auto update function

2005-07-19 Thread daq
returns OPAQUE type. CREATE FUNCTION update_pass() RETURNS OPAQUE AS $$ UPDATE hoy SET pass_md5=md5(pass) WHERE id=new.id; SELECT 1; $$ LANGUAGE SQL; DAQ ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore

Re: [SQL] Create trigger for auto update function

2005-07-18 Thread daq
GGER triger_users_pass_md5 AFTER INSERT OR UPDATE ON hoy FOR EACH ROW EXECUTE PROCEDURE update_pass; DAQ ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

Re: [SQL] SQL query

2004-02-04 Thread daq
| en PC> sample | 2003-11-11 18:11:10 | de select * from a where lang_id='en' and modification_date>(select modification_date from a as a_alias where a_alias.id=a.id and a_alias.lang_id='pl') Try this! DAQ ---(end of broadcast)--

[SQL] Canceling other backend's query

2003-08-27 Thread daq
Hi, Can i cancel querys runing on other backends, or disconnect a client from the server? I can kill the backend process, but sometimes this causing shared memory troubles. DAQ ---(end of broadcast)--- TIP 7: don't forget to increase your

Re: [SQL] CAST from VARCHAR to INT

2003-01-24 Thread daq
n (input::text::int4); END; ' language 'plpgsql'; When you try the cast varchar_field::integer or varchar_field::int4 Postgres call the function named int4 and takes varchar type parameter. DAQ ---(end of broadcast)--- TIP 3: if pos

[SQL] pg_restore vs. indexes

2002-07-24 Thread daq
execute query: ERROR: index "fhelyhist_fhszam_ind" does not exist If i drop the index before the pg_dump, then the same hapens with another index. What i do wrong? DAQ Ps.: The TOC of the dump is atached. ; ; Archive created at Wed Jul 24 12:09:03 2002 ; dbname: byenet ; TOC En