Re: [SQL] Is DATETIME an ANSI-SQL type?

2008-01-15 Thread Joost Kraaijeveld
Hi, On Tue, 2008-01-15 at 10:53 -0500, Tom Lane wrote: > =?ISO-8859-1?Q?Magne_M=E6hre?= <[EMAIL PROTECTED]> writes: > > Joost Kraaijeveld wrote: > >> Can anyone tell me if DATETIME is an ANSI SQL type? > > > No. > > The Datetime types defined in SQL (ISO/

[SQL] Is DATETIME an ANSI-SQL type?

2008-01-15 Thread Joost Kraaijeveld
Hi, Well the subject says it all: Can anyone tell me if DATETIME is an ANSI SQL type? TIA -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 web: www.askesis.nl ---(end of broadcast

[SQL] alias required by standard or PostgreSQL?

2007-12-02 Thread Joost Kraaijeveld
Hi, If I run the query "select * from (select * from table_name)" PostgreSQL complains with ERROR: subquery in FROM must have an alias HINT: For example, FROM (SELECT ...) [AS] foo. Is the alias required by the ISO standard or is this a PostgreSQL requirement? TIA -- Groet

[SQL] How to retrieve a n-ary tree in SQL?

2007-05-14 Thread Joost Kraaijeveld
Hi, Is there a way to get a query (of function) to retrieve a n-ary tree: 1 parent node has n children and the tree is n levels deep? TIA -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 web: www.askesis.nl

[SQL] Howto convert / (re)store xml column to table in trigger using contrib/xml2?

2007-05-12 Thread Joost Kraaijeveld
pointers to a solution is really appreciated (solutions also ;-)) TIA -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 web: www.askesis.nl ---(end of broadcast)--- TIP 4: Have

[SQL] Foreign key reference counting strategy?

2006-10-14 Thread Joost Kraaijeveld
Hi, Is there a strategy to implement reference counting for foreign keys so that if the last reference to the key is deleted, the record is deleted also? TIA -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 web

Re: [SQL] Transactional behaviour with trigger

2006-09-17 Thread Joost Kraaijeveld
Hi Michael, Thanks for answering. On Sun, 2006-09-17 at 08:36 -0600, Michael Fuhr wrote: > On Sun, Sep 17, 2006 at 02:32:10PM +0200, Joost Kraaijeveld wrote: > Where does prototype.customers fit in? Are you sure it has a row > that matches the WHERE clause? Where would that row have

[SQL] Transactional behaviour with trigger

2006-09-17 Thread Joost Kraaijeveld
-> no customer record??? 6. end transction TIA -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 web: www.askesis.nl ---(end of broadcast)--- TIP 5: don't forget to

Re: [SQL] Can I do this smarter?

2006-07-14 Thread Joost Kraaijeveld
This is clearly the "Aaron helps day" ;-) Thanks, -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 web: www.askesis.nl ---(end of broadcast)--- TIP 6: explain

Re: [SQL] Can I do this smarter?

2006-07-13 Thread Joost Kraaijeveld
; INNER JOIN salesorders ON ( >salesorders.objectid = invoices.salesorderobjectid > ) > INNER JOIN customers ON ( >customers.objectid = salesorder.customer > ) > > You should do INNER and OUTER joins for connecting the tables by > their foreign keys. Thanks for the quick (and work

[SQL] Can I do this smarter?

2006-07-13 Thread Joost Kraaijeveld
objectid = (select customer from salesorders where objectid = invoices.salesorderobjectid)) from invoices Can I do this smarter as the three subselects select the same customer three times and I would think that 1 time is enough? TIA -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14

Re: [SQL] Why do I get these results?????

2006-03-03 Thread Joost Kraaijeveld
On Fri, 2006-03-03 at 09:51 +, Ragnar wrote: > Looks like it either sorts lowercase before uppercase > or treats them as equivalent. Ooops. I must sort resultset using the same condition is I select. Oops again. them. -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14

Re: [SQL] Why do I get these results?????

2006-03-03 Thread Joost Kraaijeveld
can not influence the content of the > result What do you mean by that? -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: [EMAIL PROTECTED] web: www.askesis.nl ---(end of broadcast)--- TIP 6: explain analyze is your friend

[SQL] Why do I get these results?????

2006-03-03 Thread Joost Kraaijeveld
quot;5";"";"jansen" "5712XG";"SOMEREN";"13";"";"jansen" "6511PS";"NIJMEGEN";"23";"";"Jansen" "6523RE";"NIJMEGEN";"13";"";"

Re: [SQL] How to get a count() where column < ''?

2005-12-04 Thread Joost Kraaijeveld
ipCode < '1234ab' -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: [EMAIL PROTECTED] web: www.askesis.nl ---(end of broadcast)--- TIP 9: In versions below

Re: [SQL] How to get a count() where column < ''?

2005-12-04 Thread Joost Kraaijeveld
by a non-grouped query? The query below gives the same error: SELECT zipcode, COUNT(*) FROM prototype.customers, prototype.addresses WHERE customers.contactaddress = addresses.objectid AND zipCode < '2716BN' -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 652

[SQL] How to get a count() where column < ''?

2005-12-04 Thread Joost Kraaijeveld
LECT COUNT(customers.objectid) FROM prototype.customers, prototype.addresses WHERE customers.contactaddress = addresses.objectid AND zipCode < '2716BN' ORDER By zipCode, houseNumber Anyone an idea? TIA -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmege

[SQL] Foreign key to 2 tables problem

2005-11-22 Thread Joost Kraaijeveld
Hi, Is there a way to create a foreign key to 2 tables: e.g. a bankaccount table that has a column "owner", that must point to a record in either the customer or the supplier table? TIA -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-38

Re: [SQL] Trigger / rule question

2005-11-20 Thread Joost Kraaijeveld
Hi Peter, On Sun, 2005-11-20 at 12:08 +0100, Peter Eisentraut wrote: > Joost Kraaijeveld wrote: > > 1. Does an insert, update or delete statement return before or after > > an "After" trigger (is such a trigger or rule synchronous or > > a-synchronous? >

[SQL] Trigger / rule question

2005-11-20 Thread Joost Kraaijeveld
, does the insert, update or delete statement (transaction) fail? TIA -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: [EMAIL PROTECTED] web: www.askesis.nl ---(end of

Re: [SQL] Help with simple SQL query?

2005-10-05 Thread Joost Kraaijeveld
ons. And a working anser!. Which manual did I miss ;-) Thanks. -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: [EMAIL PROTECTED] web: www.askesis.nl ---(end of broadcast)--

[SQL] Help with simple SQL query?

2005-10-05 Thread Joost Kraaijeveld
Can someone help? TIA -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: [EMAIL PROTECTED] web: www.askesis.nl ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] How to add column from old_table to new_table?

2005-09-21 Thread Joost Kraaijeveld
Thanks all. Too much coffee, too little sleep. -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: [EMAIL PROTECTED] web: www.askesis.nl ---(end of broadcast

Re: [SQL] How to add column from old_table to new_table?

2005-09-21 Thread Joost Kraaijeveld
e row returned by a subquery used as an expression" if ran. -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: [EMAIL PROTECTED] web: www.askesis.nl ---(end of

[SQL] How to add column from old_table to new_table?

2005-09-21 Thread Joost Kraaijeveld
le_id) where new_table.id = old_table.id TIA -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: [EMAIL PROTECTED] web: www.askesis.nl ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] What should this query match?

2005-09-14 Thread Joost Kraaijeveld
ct syntax ;-). Could you give me an example? I understand that the following query returns all matches but I want everything smalle than the match SELECT COUNT(*) FROM prototype.customers WHERE lower(lastName) ilike 'jan%' TIA -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenst

[SQL] What should this query match?

2005-09-14 Thread Joost Kraaijeveld
tomers WHERE lower(lastName) < lower('Jan%') SELECT COUNT(*) FROM customers WHERE lower(lastName) <= lower('Jan%') TIA -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: [EMAIL

Re: [SQL] [GENERAL] How do I copy part of table from db1 to db2

2005-08-31 Thread Joost Kraaijeveld
On Wed, 2005-08-31 at 10:29 -0400, Tom Lane wrote: > Joost Kraaijeveld <[EMAIL PROTECTED]> writes: > If, as seems more likely, there's a mishmash of different encodings then > you are in for some pain. At the minimum you'll have to separate out Yep. The original databa

Re: [SQL] [GENERAL] How do I copy part of table from db1 to db2

2005-08-31 Thread Joost Kraaijeveld
On Wed, 2005-08-31 at 14:14 +0200, Thomas Pundt wrote: > pg_dump -t artik munttest | recode latin1..utf8 | psql muntfinal Because the source encoding is unknown (the actual source database was an ODBC source without known encoding that was copied with a C++ written to a SQL_ASCII PostgreSQL data

Re: [SQL] [GENERAL] How do I copy part of table from db1 to db2 (and

2005-08-31 Thread Joost Kraaijeveld
On Wed, 2005-08-31 at 12:40 +0200, Roman Neuhauser wrote: > check these man pages: pg_dump(1), pg_restore(1), alter_table(7) I am afraid that the problem is more complex. The original database (which is created with SQL_ASCII) contains invalid byte sequences in some columns (target database

[SQL] How do I copy part of table from db1 to db2 (and rename the columns)?

2005-08-31 Thread Joost Kraaijeveld
Hi, I want to copy several columns of a source table from db1 to db2, and create the target table and rename the columns in the process. Is that possible in PostgresQL? If so, an example or url for such a command /script would be appreciated... TIA Joost ---(end of b