[SQL] "'" in SQL INSERT statement

2001-01-25 Thread Markus Wagner
Hi, I have some data that I wish to transfer into a database using perl/DBI. Some of the data are strings containing the apostrophe "'" which I use as string delimiter. How can I put these into my database using the INSERT statement? Thanks, Markus

Re: [SQL] "'" in SQL INSERT statement

2001-01-25 Thread Oliver Elphick
Markus Wagner wrote: >Hi, > >I have some data that I wish to transfer into a database using perl/DBI. >Some of the data are strings containing the apostrophe "'" which I use >as string delimiter. > >How can I put these into my database using the INSERT statement? Escape the apostrop

Re: [SQL] "'" in SQL INSERT statement

2001-01-25 Thread Alessio Bragadini
Markus Wagner wrote: > I have some data that I wish to transfer into a database using perl/DBI. If you use Perl DBI you should issue statements like $dbh->do ('INSERT INTO table (field1, field2) VALUES (?,?)', undef, $value1, $value2); This binding takes care of quoting and escapes all

Re: [SQL] "'" in SQL INSERT statement

2001-01-25 Thread Brett W. McCoy
On Thu, 25 Jan 2001, Markus Wagner wrote: > I have some data that I wish to transfer into a database using perl/DBI. > Some of the data are strings containing the apostrophe "'" which I use > as string delimiter. > > How can I put these into my database using the INSERT statement? You will need

[SQL] Cannot CREATE INDEX that contains a function

2001-01-25 Thread Roberto Bertolusso
I am testing Postgresql-7.0.3 I would like to have an index all in lowercase to speed up this select: SELECT * FROM test WHERE lower(username) = 'max'; Please tell me what am I doing wrong: In psql... testdb=# CREATE TABLE test (username varchar(50)); CREATE testdb=# CREATE UNIQUE INDEX test_ind

Re: [SQL] Rule not invoked in 7.1

2001-01-25 Thread Jan Wieck
Tom Lane wrote: > Kyle <[EMAIL PROTECTED]> writes: > > ERROR: Cannot update a view without an appropriate rule. > > 7.1 insists that you provide an *unconditional* DO INSTEAD rule > for a view. What do you think was happening on your old database > when the "where old.status = 'appr'" clause was

Re: [SQL] unreferenced primary keys: garbage collection

2001-01-25 Thread Albert REINER
> On Tue, 23 Jan 2001, Forest Wilkinson wrote: > > > Jan, > > > > Thanks for the reply, but your solution is rather unattractive to me. It > > requires that, any time a reference to an address id is changed, five > > tables be searched for the address id. This will create unwanted overhead If

Re: [SQL] Rule not invoked in 7.1

2001-01-25 Thread Kyle
Jan Wieck wrote: Tom Lane wrote: > Kyle <[EMAIL PROTECTED]> writes: > > ERROR:  Cannot update a view without an appropriate rule. > > 7.1 insists that you provide an *unconditional* DO INSTEAD rule > for a view.  What do you think was happening on your old database > when the "where old.status =

[SQL] Re: Inserting and incrementing with MAX aggregate

2001-01-25 Thread Keith Perry
Ahhh, thank you that worked. I don't know why but for some reason I didn't think I could do a subquery in an insert *laff*- 'learn something new everyday :) Keith- Ian Harding wrote: > Could you not: > > insert into events (eid,name) values ((SELECT max(eid) FROM > EVENTS)+1,'server down'); >

Re: [SQL] "'" in SQL INSERT statement

2001-01-25 Thread Dan Lyke
Alessio Bragadini writes: > Markus Wagner wrote: > > I have some data that I wish to transfer into a database using perl/DBI. > > If you use Perl DBI you should issue statements like > $dbh->do ('INSERT INTO table (field1, field2) VALUES (?,?)', > undef, $value1, $value2); $dbh->quote() al

Re: [SQL] "'" in SQL INSERT statement

2001-01-25 Thread Jie Liang
Hi, Using a backslash to escape it. insert into table(field) values('what\'s that'); Jie LIANG Internet Products Inc. 10350 Science Center Drive Suite 100, San Diego, CA 92121 Office:(858)320-4873 [EMAIL PROTECTED] www.ipinc.com On Thu, 25 Jan 2001, Markus Wagner wrote: > Hi, > > I have s

[SQL] crypt and decrypt

2001-01-25 Thread Marcos Aurélio S. da Silva
How can i crypt and decrypt data when insert or selecting in a database?

[SQL] Don't want blank data

2001-01-25 Thread David Olbersen
Greetings, Is there a way to have postgresql always return a value for each row requested? To be more clear, if I were using a Perl SQL hybrid I would write something like SELECT computer_ip or 'unset' FROM computers; So that if computers.computer_ip is NULL or '' I will get 'unset' ba

[SQL] Is there anything like DESCRIBE?

2001-01-25 Thread Mike D'Agosta
Hi, I have a number of empty tables and I want to get the column names and data types with an SQL statement. I want to do this procedurally, not interactively (so I can't use \d in psql). Postgres doesn't support DESCRIBE... is there any other way to do this? Thanks! Mike

Re: [SQL] #DELETED error when using Access 2000 as frontend

2001-01-25 Thread Ian Harding
Markus Wagner wrote: > Hi, > > I tried to subscribe to pgsql-interfaces several times and received "user not > found". I also searched the pgsql-interfaces archives, without success. So > here is my problem. > > I want to use pg 7.x as a backend for a MS Access application. I linked a > table via

[SQL] Change or get currentdb

2001-01-25 Thread Sergiy Ovcharuk
Hi, All! Sorry for newby question... How can I change and/or get to know a current db name using sql script in PostgreSQL? Thanks, Sergiy. P.S. it seems use doesn't work :-(

Re: [SQL] Change or get currentdb

2001-01-25 Thread David Olbersen
>From \? \c[onnect] [dbname|- [user]] connect to new database (currently '') so typing "\c" gives you the database you're currently connected to and "\c " would connect you to that database. On Thu, 25 Jan 2001, Sergiy Ovcharuk wrote: ->How can I change and/or get to know a c

Re: [SQL] Don't want blank data

2001-01-25 Thread Stephan Szabo
On Thu, 25 Jan 2001, David Olbersen wrote: > Greetings, > Is there a way to have postgresql always return a value for each row > requested? To be more clear, if I were using a Perl SQL hybrid I would write > something like > > SELECT computer_ip or 'unset' FROM computers; > > So that

[SQL] RE: Is there anything like DESCRIBE?

2001-01-25 Thread Michael Davis
This works for me: SELECT DISTINCT c.relname as table_name, a.attname as column_name, t.typname, pa.adsrc as default FROM (pg_attribute a join pg_class c on a.attrelid = c.oid join pg_type t on a.atttypid = t.oid) left join pg_attrdef pa on c.oid = pa.adrelid AND a

Re: [SQL] Is there anything like DESCRIBE?

2001-01-25 Thread clayton cottingham
Mike D'Agosta wrote: > > Hi, > >I have a number of empty tables and I want to get the column names and > data types with an SQL statement. I want to do this procedurally, not > interactively (so I can't use \d in psql). Postgres doesn't > support DESCRIBE... is there any other way to do thi

Re: [SQL] Is there anything like DESCRIBE?

2001-01-25 Thread Oliver Elphick
"Mike D'Agosta" wrote: >Hi, > > I have a number of empty tables and I want to get the column names and >data types with an SQL statement. I want to do this procedurally, not >interactively (so I can't use \d in psql). Postgres doesn't >support DESCRIBE... is there any other way to d

Re: [SQL] Don't want blank data

2001-01-25 Thread Oliver Elphick
David Olbersen wrote: >Greetings, > Is there a way to have postgresql always return a value for each row > requested? To be more clear, if I were using a Perl SQL hybrid I would wri >te > something like > > SELECT computer_ip or 'unset' FROM computers; > > So that if com

[SQL] Re: Problem with Dates

2001-01-25 Thread Glen and Rosanne Eustace
template1=# select '31/12/2000'::date; ?column? 2000-12-31 (1 row) template1=# select '31/12/2000'::date + '365 days'::timespan; ?column? 2002-01-01 00:00:00+13<<< Wrong (1 row) template1=# select '31/12/2000'::date + '364 days'::time

[SQL] Re: Is there anything like DESCRIBE?

2001-01-25 Thread Ron Peterson
Mike D'Agosta wrote: > > Hi, > >I have a number of empty tables and I want to get the column names and > data types with an SQL statement. I want to do this procedurally, not > interactively (so I can't use \d in psql). Postgres doesn't > support DESCRIBE... is there any other way to do thi

Re: [SQL] Cannot CREATE INDEX that contains a function

2001-01-25 Thread Tom Lane
Roberto Bertolusso <[EMAIL PROTECTED]> writes: > testdb=# CREATE TABLE test (username varchar(50)); > CREATE > testdb=# CREATE UNIQUE INDEX test_index ON test (lower(username)); > ERROR: DefineIndex: function 'lower(varchar)' does not exist Short answer in 7.0.* is to make the column be type text

[SQL] Re: abstract data types?

2001-01-25 Thread John Reid
Hi Tom, listers, Thanks for the info. > On Sat, 20 Jan 2001, Tom Lane wrote: > > >> None, I fear. The stuff you are fooling with is leftover from the old >> PostQuel language. Most of it is suffering from bit rot, because the >> developers' focus has been on SQL92 compliance for the last six

[SQL] Re: abstract data types?

2001-01-25 Thread John Reid
Hi Josh et al, Sorry for the tardy reply, and thanks for your comments. Any suggestions or pointers on robust database design will be greatly appreciated. Josh Berkus wrote: > Jim, > > >>> I'm trying to figure out what support PostgreSQL >> >> offers for SQL99 >> >>> abstract data type