[SQL] UPDATE: Apparent referential integrity bug in PL/pgSQL

2002-10-18 Thread Brian Blaha
The workaround I mentioned in the previous message doesn't turn out to work after all. The series of statements seems to require explicitly calling two functions. ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an

[SQL] TRIGGERed INSERTS

2002-10-18 Thread Martin Crundall
Howdy; I'm writing a script to pre-populate a database system that's already in place. The database system is in an advanced stage of development and includes many stored procedures and TRIGGERS. The script is really a stored procedure designed to be executed by the system's admin guy as

Re: [SQL] error...what to do?

2002-10-18 Thread Stephan Szabo
On Sat, 12 Oct 2002, George wrote: beckerbalab2= select * from ffix_ability; ability_name | ability_description | type| cost beckerbalab2= SELECT ffix_ability.name, ffix_ability.cost ^^ ffix_ability.ability_name, right? Same below. beckerbalab2- FROM

[SQL] Apparent referential integrity bug in PL/pgSQL

2002-10-18 Thread Brian Blaha
I have a function that operates on two tables A and B, such that B has a foreign key on A, as follows: INSERT INTO A (...) several times INSERT INTO B (...) several times, with foreign keys pointing to the new members of A DELETE FROM A (...), possibly including some of the newly added members

Re: [SQL] Can I create working trigger on view

2002-10-18 Thread Tom Lane
Acue [EMAIL PROTECTED] writes: Can I create working trigger on view? Not usefully. No tuple will ever actually be inserted into the view, therefore the trigger will never fire. regards, tom lane ---(end of broadcast)---

Re: [SQL] Is there anyway to do this?

2002-10-18 Thread Bruno Wolff III
On Fri, Oct 18, 2002 at 12:45:56 -0400, Wei Weng [EMAIL PROTECTED] wrote: I have a table Table Users Column | Type | Modifiers ---++--- userid| character varying(40) | not null username | character

[SQL] help!

2002-10-18 Thread John Geng
how to migrate sql from MS sql server to postgresql? i'd like to tranfer sql schema from MS serverExample:***1*if exists (select * from sysobjects where id = object_id(N'[admin].[test]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)drop table

Re: [SQL] foreign keys again

2002-10-18 Thread wishy wishy
hi folks, For a certain table A, I need to find out the names of the columns who have a foreign key to a specific table B using the catalog.Has anyone done this before entirely using pgsql.I have been through the archieves and have not been able to find the required information. thanks kprasad

[SQL] hi

2002-10-18 Thread lz John
i'd like to tranfer sql schema from MS serverExample:***1*if exists (select * from sysobjects where id = object_id(N'[admin].[test]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)drop table [admin].[test]

Re: [SQL] date

2002-10-18 Thread wishy wishy
hi folks, we have a PostgreSQL 7.2.2 on i686-pc-linux-gnu, compiled by GCC 2.96 installation on pogo linux 7.2 we are facing a data problem when we do the following select to_char(to_date('1969-10-22','-MM-DD'),'-MM-DD'); ERROR: Unable to convert date to tm we have been trying to find a

[SQL] error...what to do?

2002-10-18 Thread George
The I am trying to do a set difference query. The query question is as follows: 3.Find the names and costs of all abilities that Zidane can learn, but that Steiner cannot. Can anyone help with this .please. The tables to use are as follows: beckerbalab2= select * from ffix_ability;

[SQL] Can I search for an array in csf?

2002-10-18 Thread Vernon Wu
One field of a table stores an array of characters in a string fromat as a,b,c,d. Is anyway to apply a select statement without using stored procedure? Thanks for your input. Vernon ---(end of broadcast)--- TIP 4: Don't 'kill -9' the

Re: [SQL] error...what to do?

2002-10-18 Thread Andrew Perrin
Read the error text: beckerbalab2= SELECT ffix_ability.name, ffix_ability.cost ^ beckerbalab2- FROM ffix_can_learn NATURAL JOIN ffix_ability beckerbalab2- WHERE ffix_can_learn.character_name = 'Zidane' beckerbalab2- EXCEPT --this is the difference

[SQL] functions that return a dataset or set of rows

2002-10-18 Thread Brian Ward
How do I create a function that returns a set of row; I can't seem to find the datatype that the return set should be declared as. ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send unregister

[SQL] foreign key, create table, and transactions

2002-10-18 Thread Jeffrey Green
Hello. I was wondering if anybody's run across the problem of creating tables with foreign key constraints out of order. What I mean by this is that say I want a table called pictures that has a foreign key reference to a table people. If I define pictures before table, I keep getting an

Re: [SQL] triggers

2002-10-18 Thread Bruce Momjian
Stian Riis wrote: Hi. Does anyone know if it is posible to make a trigger that execute an external program ? I want to execute a another program on the server when I get a row in one of my tables... Yes, you can use plperl and call an external program from there, or us plsh and run it that

Re: [SQL] Locking that will delayed a SELECT

2002-10-18 Thread Tom Lane
Ludwig Lim [EMAIL PROTECTED] writes: *** For clarification *** In the SQL command reference of PostgreSQL: in SELECT statement section : The FOR UPDATE clause allows the SELECT statement to perform exclusive locking of selected rows Hmm. That is a misstatement: FOR UPDATE only

Re: [SQL] functions that return a dataset or set of rows

2002-10-18 Thread Bruce Momjian
Brian wrote: Is it not possible in 7.2? No, not really. Gaetano Mendola wrote: Brian Ward [EMAIL PROTECTED] wrote in message news:aofqbd$10v5$1;news.hub.org... How do I create a function that returns a set of row; I can't seem to find the datatype that the return set should be

Re: [SQL] foreign key, create table, and transactions

2002-10-18 Thread Stephan Szabo
On Fri, 11 Oct 2002, Jeffrey Green wrote: Hello. I was wondering if anybody's run across the problem of creating tables with foreign key constraints out of order. What I mean by this is that say I want a table called pictures that has a foreign key reference to a table people. If I

Re: [SQL] isAutoIncrement and Postgres

2002-10-18 Thread Jean-Luc Lachance
Are you looking for SERIAL data type? Josh Berkus wrote: Jim, Do any existing drivers / database version combinations support the isAutoIncrement method? What programming language are you referring to? VB? Delphi? -- -Josh Berkus Aglio Database Solutions San Francisco

Re: [SQL] join question

2002-10-18 Thread Stephan Szabo
On Fri, 18 Oct 2002, Frank Morton wrote: For the SQL gurus, a query where I'm not getting the expected results. Trying to write it using sql compatible with both postgres and mysql. There are two tables: table = profile int id char name table = attribute int id int containerId char

Re: [SQL] join question

2002-10-18 Thread Jean-Luc Lachance
I think you meant: select profile.name from profile,attribute where ( profile.id = attribute.containerId) and ( profile.state =' 1020811' or ( attribute.name = 'marketsegment' and attribute.value = '1020704'); select profile.name from profile,attribute where ((profile.state='1020811') or

[SQL] adding column with not null constraint

2002-10-18 Thread Vivek Khera
I'm looking to add a column to my database with not null and a default value: vk= alter table msg_owner add column user_optional_fields varchar(255) NOT NULL default ''; ERROR: Adding columns with defaults is not implemented. Add the column, then use ALTER TABLE SET DEFAULT. vk= alter

Re: [SQL] functions that return a dataset or set of rows

2002-10-18 Thread Roberto Mello
On Thu, Oct 17, 2002 at 05:41:22PM -0400, Brian wrote: Is it not possible in 7.2? In 7.2 you can return a cursor, which gets close and lets you basically accomplish the goal. See the PL/pgSQL developer documentation for 7.3 (returning cursors was omitted accidentally (?) in the 7.2