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 documentati

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

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 contai

Re: [SQL] date

2002-10-18 Thread Tom Lane
"wishy wishy" <[EMAIL PROTECTED]> writes: > 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

[SQL] join question

2002-10-18 Thread Frank Morton
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 name char value   Multiple attribute rows corre

Re: [SQL] date

2002-10-18 Thread Jean-Luc Lachance
Try select to_char( '1969-10-22'::date, '-MM-DD'); wishy wishy wrote: > > 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','-M

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 F

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 that has a > > foreign key reference to a table . If I define pic

Re: [SQL] isAutoIncrement and Postgres

2002-10-18 Thread Josh Berkus
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 ---(end of broadcast)---

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 r

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 UPD

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 t

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-

[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 that has a foreign key reference to a table . If I define pictures before table, I keep getting an error (Relation "

[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

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 differe

[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 postmas

[SQL] isAutoIncrement and Postgres

2002-10-18 Thread jm
Do any existing drivers / database version combinations support the isAutoIncrement method? If not - does anyone have any suggested workarounds? I am having problems with autogenrated INSERTS because I can't detect an AutoIncrement column. -jm ---(end of broadcast)--

[SQL] How to create secondary key!!

2002-10-18 Thread Nelson Yong
good day, i'm using pgAdmin II as the remote client, after importing the text file to postgresql database; i'm start trying to find the way to create the primary key and secondary key. unfortunely, under the pgAdmin II there aren't any tools to do that. However i managed to fine the way to cre

[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_abi

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] 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] go***2**

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] 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 [adm

[SQL]

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 [ad

[SQL] triggers

2002-10-18 Thread Stian Riis
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... -Stian ---(end of broadcast)--- TIP 1: subscribe and unsubscribe c

[SQL] Can I create working trigger on view

2002-10-18 Thread Акулов Александр
Hello! Please, help me! Can I create working trigger on view? The problem is: I need a plpgsql function that execute on insert (or update, or delete) into view and knows the *OLD* and *NEW*. (Number of fields can be more than 16) Something like this: Create Sequence id; Create Tab

Re: [SQL] [pgadmin-support] hi

2002-10-18 Thread Hepworth, Mike
lz,   You could use the plpgsql function language and create a function that tests for the existence of the file and drop it if it does.   Something like this:   select dropTableIfExists('test');   The dropTableIfExists would be the plpgsql function that you would need to write.   Later,  

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

2002-10-18 Thread Brian
Is it not possible in 7.2? 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 declared as. You should wait for Pos

Re: [SQL] object oriented vs relational DB

2002-10-18 Thread Marten Feldtmann
Josh Berkus schrieb: I've looked into OODBMS for my business. However, I've kept from using any in production for one simple reason: lack of a standard. There is no international standard for OODBMS, meaning that each OODBMS is its own animal and databases are not at all portable between dif

[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

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

2002-10-18 Thread Ian Harding
MSSQL Server does not recognize this syntax, but it does accept select distinct substring(username, 1, 1) Ian A. Harding Programmer/Analyst II Tacoma-Pierce County Health Department (253) 798-3549 [EMAIL PROTECTED] >>> Bruno Wolff III <[EMAIL PROTECTED]> 10/18/02 10:13AM >>> On Fri, Oct 18, 200

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

[SQL] Is there anyway to do this?

2002-10-18 Thread Wei Weng
I have a table Table "Users" Column | Type | Modifiers ---++--- userid| character varying(40) | not null username | character varying(64) | I want to get all the distinct first character of all usernames. And

Re: [SQL] TRIGGERed INSERTS

2002-10-18 Thread Martin Crundall
Thanks Tom. The work-around was to create the "script" in SQL -- using SELECT INTO statements to capture the key values -- instead of creating the "script" as a stored procedure. Seems like a "transaction" issue. Having transactions occur at the SELECT level is very intuitive and a really nice,

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

2002-10-18 Thread Stephan Szabo
On Fri, 18 Oct 2002, Brian Blaha wrote: > 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 (...), p

Re: [SQL] Locking that will delayed a SELECT

2002-10-18 Thread Ludwig Lim
--- Tom Lane <[EMAIL PROTECTED]> wrote: > Achilleus Mantzios <[EMAIL PROTECTED]> > writes: > >> The problem is solved > >> > >> a) Using SERIALIZABLE XACTION ISOLATION LEVEL > >> b) in T2 using "select for update" instead of > select. That way T2's > >> queries will wait untill T1's statements co

Re: [SQL] TRIGGERed INSERTS

2002-10-18 Thread Tom Lane
"Martin Crundall" <[EMAIL PROTECTED]> writes: >Some of the data tables have "AFTER INSERT" TRIGGERs on them that, in > turn, insert some subordinate items into parallel data tables and the > central pointer/ordering table. It looks to me like AFTER triggers are fired upon return to the main lo

Re: [SQL] Locking that will delayed a SELECT

2002-10-18 Thread Tom Lane
Achilleus Mantzios <[EMAIL PROTECTED]> writes: >> The problem is solved >> >> a) Using SERIALIZABLE XACTION ISOLATION LEVEL >> b) in T2 using "select for update" instead of select. That way T2's >> queries will wait untill T1's statements commit or rollback. ISTM that SERIALIZABLE mode will not s

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

[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

[SQL] Can I create working trigger on view

2002-10-18 Thread Acue
Hello! Please, help me! Can I create working trigger on view? The problem is: I need a plpgsql function that execute on insert (or update, or delete) into view and knows the *OLD* and *NEW*. (Number of fields can be more than 16) Something like this: Create Sequence id; Create Tab

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

2002-10-18 Thread Josh Berkus
Acue, > Can I create working trigger on view? > > The problem is: > I need a plpgsql function that execute on insert (or update, > or delete) into view and knows the *OLD* and *NEW*. > (Number of fields can be more than 16) No. Create a RULE instead, which can be created on a view: http:

Re: [SQL] Locking that will delayed a SELECT

2002-10-18 Thread Achilleus Mantzios
On Fri, 18 Oct 2002, Achilleus Mantzios wrote: > Second small xaction T2's select statemenst will use values commited > before these select statements started. That is, these queries > will NOT see values updated by T1. > > The problem is solved > > a) Using SERIALIZABLE XACTION ISOLATION LEVEL >

Re: [SQL] Locking that will delayed a SELECT

2002-10-18 Thread Achilleus Mantzios
On Fri, 18 Oct 2002, Christoph Haller wrote: > >Suppose I have a transaction (T1) which executes a > > complicated stored procedure. While T1 is executing, > > trasaction #2 (T2) begins to execute. > > > > T1 take more time to execute that T2 in such a way > > that T2 finished earlier tha

Re: [SQL] Locking that will delayed a SELECT

2002-10-18 Thread Christoph Haller
>Suppose I have a transaction (T1) which executes a > complicated stored procedure. While T1 is executing, > trasaction #2 (T2) begins to execute. > > T1 take more time to execute that T2 in such a way > that T2 finished earlier than T1. The result is that > t2 returns set of data before i

[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 app

[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 E