[SQL] Sequences do not obey transactions...

2000-06-20 Thread Ryan Kirkpatrick
Either I am missing something or I found a bug in PostgreSQL. Hopefully it is the former. :) Simply, I am trying to use a sequence to generate unique id numbers for a table. Now, a number of the fields in this table have 'check constraints'. What happens, is if I attempt to insert

Re: [SQL] \copy...

2000-06-20 Thread Christopher Sawtell
On Fri, 16 Jun 2000, Ed wrote: > Hi, > > I have a file that look like this : > > firstname|lastname|[EMAIL PROTECTED] > firstname2|lastname2|[EMAIL PROTECTED] > > and a table foo like : > > firstname varchar(30), > lastname varchar(30), > emailvarchar(50) > > and I would like to do a :

Re: [SQL] Type conversion

2000-06-20 Thread Ed Loehr
Tom Lane wrote: > > Ice Planet <[EMAIL PROTECTED]> writes: > > B: insert into t2 values (select int2(int4(b)) from t1 where a = 1) > > Works for me when spelled correctly: I think you can also leave out the 'values' for a sub-select insert, though I haven't checked to see if it matters... Rega

Re: [SQL] Type conversion

2000-06-20 Thread Tom Lane
Ice Planet <[EMAIL PROTECTED]> writes: > B: insert into t2 values (select int2(int4(b)) from t1 where a = 1) Works for me when spelled correctly: regression=# insert into t2 (select int2(int4(b)) from t1 where a = 1); INSERT 314647 1 If you make a suitable conversion function then you can omit

[SQL] Type conversion

2000-06-20 Thread Ice Planet
Hello I have following situation create table t1 (a int8 primary key, b int8); create table t2 (x int2); insert into t1 values (1,1); A: insert into t2 values (select b from t1 where a = 1) B: insert into t2 values (select int2(int4(b)) from t1 where a = 1) Both possibilites fail, how can i d

Re: [SQL] BETWEEN

2000-06-20 Thread Tom Lane
Joseph Shraibman <[EMAIL PROTECTED]> writes: > Why is BETWEEN inclusive? Because the SQL92 spec says so: 6) "X BETWEEN Y AND Z" is equivalent to "X>=Y AND X<=Z". > I had assumed that it was like the english > between, which is exclusive. That's debatable... re

[SQL] BETWEEN

2000-06-20 Thread Joseph Shraibman
Why is BETWEEN inclusive? I had assumed that it was like the english between, which is exclusive. playpen=# create table numbs ( a int); CREATE playpen=# insert into numbs values(1); INSERT 35913 1 playpen=# insert into numbs values(2); INSERT 35914 1 playpen=# insert into numbs values(3); INSE

Re: [SQL] Re: Simple search question

2000-06-20 Thread mikeo
do select setval('seqname',#); At 01:17 PM 6/15/00 -0500, John McKown wrote: > >Alex wrote in message <[EMAIL PROTECTED]>... >>Hi, >> >>> I had the same problem but was using Java, not PHP (I guess that >>> whatever I can do in JDBC, you can do in PHP ;-)). >>> >>> SELECT last_value FROM ; >>

Re: [SQL] Re: Simple search question

2000-06-20 Thread Stephan Szabo
> This brings me back to another unanswered question recently posted up,maybe > it is impossible... > I declared a new table with one of the types as serial (which is really just a > sort of macro I believe, which automates the creation of a few things for your > convenience), which initialises th

Re: [SQL] \copy...

2000-06-20 Thread Webb Sprague
Finally--a question I think I can answer! You need to specify what delimiters you use in your .dat file; the default for COPY is tab, but you can change that to | with copy tablename from '/home/ed/import.dat' delimiters '|' Hope this works...(oops--I mean 'helps') --- Ed <[EMAIL P

[SQL] Re: Simple search question

2000-06-20 Thread John McKown
Alex wrote in message <[EMAIL PROTECTED]>... >Hi, > >> I had the same problem but was using Java, not PHP (I guess that >> whatever I can do in JDBC, you can do in PHP ;-)). >> >> SELECT last_value FROM ; > >This brings me back to another unanswered question recently posted up, maybe >it is impos

[SQL] Does anyone know of a function equivilant to Oracle's decode function?

2000-06-20 Thread DalTech - Continuing Technical Education
I have not seen much information about this anywhere on the web.   If anyone has seen, or written a function similar, could you please let me know where?   Thanks.

[SQL] \copy...

2000-06-20 Thread Ed
Hi, I have a file that look like this : firstname|lastname|[EMAIL PROTECTED] firstname2|lastname2|[EMAIL PROTECTED] and a table foo like : firstname varchar(30), lastname varchar(30), emailvarchar(50) and I would like to do a : copy tablename from '/home/ed/import.dat'; But then, eve