Re: [GENERAL] Strange Postgresql behavior solved

2008-07-25 Thread Leif B. Kristensen
On Saturday 26. July 2008, Owen Hartnett wrote: >Probably some funky stuff with the router (not one of their expensive >ones) that caused all the consternation, but I originally thought >corrupt database (because I could get 117 records to come out fine, >but not the 118th). Also, I had narrowed i

Re: [GENERAL] Strange Postgresql behavior solved

2008-07-25 Thread Tom Lane
Owen Hartnett <[EMAIL PROTECTED]> writes: > I spent a day on this, and it's really not a PostgreSQL issue, but I > thought I'd post it in case someone else comes down with it. > Scenario: > I moved the physical location and networking environment of the > server. It's on Mac OS X - XServe, but

[GENERAL] Strange Postgresql behavior solved

2008-07-25 Thread Owen Hartnett
I spent a day on this, and it's really not a PostgreSQL issue, but I thought I'd post it in case someone else comes down with it. Scenario: I moved the physical location and networking environment of the server. It's on Mac OS X - XServe, but that isn't germaine to the story. Originally,

Re: [GENERAL] Sequence

2008-07-25 Thread Craig Ringer
> select * from guests; > user_id | guest_id |name > -+--+ > 1 |1 | Mark Twain > 1 |2 | Anna Black > 2 |3 | John Black > (3 rows) > > I want to have a different result of insert command: > > user_id | guest_id |name >

Re: [GENERAL] php + postgresql

2008-07-25 Thread Joshua D. Drake
On Sat, 2008-07-26 at 11:13 +0930, admin wrote: > Anyway, while I'm quite happy to continue banging out things that "just > work" in PHP for the time being, you suggest (in a subsequent post) that > there is one scripting language in particular that you'd use ... might I > enquire which languag

Re: [GENERAL] php + postgresql

2008-07-25 Thread admin
Well no PHP is conceptual undisciplined and confusing. I would not compare this with Postgresql itself which is very professional developed with a great vision. PHP is just and always was a hack. I didn't mean to compare PG and PHP at the level of engineering quality, but to suggest that perh

Re: [GENERAL] A couple of newbie questions ...

2008-07-25 Thread John DeSoi
On Jul 23, 2008, at 12:00 PM, Shane Ambler wrote: To be honest I hadn't seen the use of INSERT INTO table (fld_x, fld_y,fld_z) VALUES (DEFAULT, 'y','z') before, I have always gone with INSERT INTO table (fld_x, fld_y,fld_z) VALUES (NULL, 'y','z') is DEFAULT a better option than using NULL?

[GENERAL] Sequence

2008-07-25 Thread Alex Cheshev
Hello. Each user has a lot of guests. Each guest only has one user. 1. I create a table users: CREATE TABLE users ( user_id SERIAL PRIMARY KEY, name varchar(256) ); 2. I create a table guests: CREATE TABLE guests ( user_id integer, guest_id SERIAL, PRIMARY KEY (user_id, guest_id), FOREI

Re: [GENERAL] Help Me !!!

2008-07-25 Thread Danyelle Gragsone
2008/7/24 <[EMAIL PROTECTED]>: > > > Hello boys, > I have a problem are not practical for sql. > > I helped to find the 'error of this query? > > SELECT > fresh.articoli.barcode, > fresh.articoli.descrizione, > fresh.articoli.grammatura, > fresh.articoli.id_marchio, > fresh.articoli.imballo,

Re: [GENERAL] PostgreSQL vs FreeBSD 7.0 as regular user

2008-07-25 Thread Zoltan Boszormenyi
Francisco Reyes írta: > On 4:53 pm 07/25/08 Zoltan Boszormenyi <[EMAIL PROTECTED]> wrote: > >> I don't know. How to determine? Running this as my own user: >> > > Is this your own machine or at an ISP? > It's my own machine, FreeBSD is installed as a VMWare guest. > If it is your own m

Re: [GENERAL] PostgreSQL vs FreeBSD 7.0 as regular user

2008-07-25 Thread Francisco Reyes
On 4:53 pm 07/25/08 Zoltan Boszormenyi <[EMAIL PROTECTED]> wrote: > I don't know. How to determine? Running this as my own user: Is this your own machine or at an ISP? If it is your own machine, then most likely you are not in a jail. You would know if you were since you would have had to do it.

Re: [GENERAL] PostgreSQL vs FreeBSD 7.0 as regular user

2008-07-25 Thread Zoltan Boszormenyi
Joshua D. Drake írta: > On Fri, 2008-07-25 at 22:39 +0200, Zoltan Boszormenyi wrote: > >> Hi, >> >> is there anyone using PostgreSQL on FreeBSD 7.0 starting from scratch? >> I compiled 8.3.3 and wanted to run initdb in my home directory but >> it fails with the error below. >> > > >> I c

Re: [GENERAL] php + postgresql

2008-07-25 Thread Scott Marlowe
On Fri, Jul 25, 2008 at 1:47 PM, Leif B. Kristensen <[EMAIL PROTECTED]> wrote: > On Friday 25. July 2008, Christophe wrote: > >>Most developers don't make deep informed decisions about PHP vs other >>languages. They use it because everyone else is, there is a huge >>ecosystem of support around it,

Re: [GENERAL] PostgreSQL vs FreeBSD 7.0 as regular user

2008-07-25 Thread Joshua D. Drake
On Fri, 2008-07-25 at 22:39 +0200, Zoltan Boszormenyi wrote: > Hi, > > is there anyone using PostgreSQL on FreeBSD 7.0 starting from scratch? > I compiled 8.3.3 and wanted to run initdb in my home directory but > it fails with the error below. > I configured the shared memory settings in advance

[GENERAL] PostgreSQL vs FreeBSD 7.0 as regular user

2008-07-25 Thread Zoltan Boszormenyi
Hi, is there anyone using PostgreSQL on FreeBSD 7.0 starting from scratch? I compiled 8.3.3 and wanted to run initdb in my home directory but it fails with the error below. [EMAIL PROTECTED] ~]$ PGDATA=/home/zozo/pgd833 PATH=/home/zozo/pgc833/bin:$PATH

Re: [GENERAL] Data base tables design questions for: user saved forms, user parameters

2008-07-25 Thread Rodrigo E. De León Plicet
On Fri, Jul 25, 2008 at 8:35 AM, Bruno Lavoie <[EMAIL PROTECTED]> wrote: > The hesitation here is : how to store the fields & values pairs, in > FIELDS_VALUES? Check out contrib/hstore: http://www.postgresql.org/docs/current/static/hstore.html -- Sent via pgsql-general mailing list (pgsql-genera

Re: [GENERAL] Problems with pg_dump and -t wildcards

2008-07-25 Thread Bill Thoen
Ah ha! I'm reading the wrong docs. Duh... I guess it's upgrade time! Thank you. Tom Lane wrote: "Joshua D. Drake" <[EMAIL PROTECTED]> writes: On Fri, 2008-07-25 at 11:36 -0600, Bill Thoen wrote: I'm having some problems with pg_dump and the -t switch. I can't get it to work using wildc

Re: [GENERAL] php + postgresql

2008-07-25 Thread Leif B. Kristensen
On Friday 25. July 2008, Christophe wrote: >Most developers don't make deep informed decisions about PHP vs other >languages. They use it because everyone else is, there is a huge >ecosystem of support around it, it's easy to get something flopping >around on the table quickly, and they know *for

Re: [GENERAL] php + postgresql

2008-07-25 Thread Jonathan Bond-Caron
On Fri Jul 25 02:20 PM, Andrew Sullivan wrote: > On Fri, Jul 25, 2008 at 01:41:50PM -0400, Jonathan Bond-Caron wrote: > >> Uhm, let's not start a PHP debate. > > The post would have been more effective if you'd stopped there ;-) Agreed :) > That said, > >> I'd say "the Web is just and always w

Re: [GENERAL] Problems with pg_dump and -t wildcards

2008-07-25 Thread Andrew Sullivan
On Fri, Jul 25, 2008 at 11:36:14AM -0600, Bill Thoen wrote: > I'm having some problems with pg_dump and the -t switch. I can't get it to > work using wildcards nor with multiple -t switches. I'm using PostgreSQL > 8.1.5 and trying to dump just a table and its associated sequence. You can't do th

Re: [GENERAL] php + postgresql

2008-07-25 Thread Tino Wildenhain
Andrew Sullivan wrote: On Fri, Jul 25, 2008 at 01:41:50PM -0400, Jonathan Bond-Caron wrote: Uhm, let's not start a PHP debate. Well it was just a innocent question since the original poster did not seem to know the language of choice good enough to solve this rather basic problem. (Note, ho

Re: [GENERAL] Problems with pg_dump and -t wildcards

2008-07-25 Thread Tom Lane
"Joshua D. Drake" <[EMAIL PROTECTED]> writes: > On Fri, 2008-07-25 at 11:36 -0600, Bill Thoen wrote: >> I'm having some problems with pg_dump and the -t switch. I can't get it >> to work using wildcards nor with multiple -t switches. I'm using >> PostgreSQL 8.1.5 and trying to dump just a table a

Re: [GENERAL] php + postgresql

2008-07-25 Thread Christophe
On Jul 25, 2008, at 11:20 AM, Andrew Sullivan wrote: On Fri, Jul 25, 2008 at 01:41:50PM -0400, Jonathan Bond-Caron wrote: I'd say "the Web is just and always was a hack" I have to object to this pretty strongly. He has a point, though. If you were starting out to build a user interface

Re: [GENERAL] I often have to do "update if exist, else insert", is my database design wrong?

2008-07-25 Thread Steve Atkins
On Jul 25, 2008, at 11:46 AM, Francisco Reyes wrote: Is this normal or are there something else I could do so I don't have to check if it exists? I would say that it is normal. For the developers: a combined insert/update command would be nice :-) Mysql has such a beast along a some oth

Re: [GENERAL] I often have to do "update if exist, else insert", is my database design wrong?

2008-07-25 Thread Francisco Reyes
> Is this normal or are there something else I could do so I don't have > to check if it exists? I would say that it is normal. > For the developers: a combined insert/update command would be nice > :-) Mysql has such a beast along a some other non SQL compliant extensions. One possible appro

Re: [GENERAL] php + postgresql

2008-07-25 Thread Andrew Sullivan
On Fri, Jul 25, 2008 at 01:41:50PM -0400, Jonathan Bond-Caron wrote: > Uhm, let's not start a PHP debate. The post would have been more effective if you'd stopped there ;-) That said, > I'd say "the Web is just and always was a hack" I have to object to this pretty strongly. What premises d

Re: [GENERAL] php + postgresql

2008-07-25 Thread Joshua D. Drake
On Fri, 2008-07-25 at 13:41 -0400, Jonathan Bond-Caron wrote: > On Fri Jul 25 01:03 PM, Joshua D. Drake wrote: > I use .NET, java and PHP and with experience you learn to use/speak the > right language for the job. "hack" languages sometimes get the job done > faster. You seemed to have complete

Re: [GENERAL] Problems with pg_dump and -t wildcards

2008-07-25 Thread Joshua D. Drake
On Fri, 2008-07-25 at 11:36 -0600, Bill Thoen wrote: > I'm having some problems with pg_dump and the -t switch. I can't get it > to work using wildcards nor with multiple -t switches. I'm using > PostgreSQL 8.1.5 and trying to dump just a table and its associated > sequence. That is because it

Re: [GENERAL] php + postgresql

2008-07-25 Thread Jonathan Bond-Caron
On Fri Jul 25 01:03 PM, Joshua D. Drake wrote: > On Fri, 2008-07-25 at 12:29 -0400, Bill Wordsworth wrote: >> Obviously he is a newbie out of the woods- couldn't make a connection >> and print results something that the rest of us have been doing for >> years. It is newbies like him and fan-boys

[GENERAL] Problems with pg_dump and -t wildcards

2008-07-25 Thread Bill Thoen
I'm having some problems with pg_dump and the -t switch. I can't get it to work using wildcards nor with multiple -t switches. I'm using PostgreSQL 8.1.5 and trying to dump just a table and its associated sequence. As shown below, the table il_sections and the sequence il_sections_gid_seq bot

Re: [GENERAL] php + postgresql

2008-07-25 Thread Joshua D. Drake
On Fri, 2008-07-25 at 12:29 -0400, Bill Wordsworth wrote: > Obviously he is a newbie out of the woods- couldn't make a connection > and print results something that the rest of us have been doing for > years. It is newbies like him and fan-boys of Ruby/Python/Perl who > give PHP a bad name. No, it

Re: [GENERAL] php + postgresql

2008-07-25 Thread Scott Marlowe
I too don't get the animosity. it's not like you can't write bad code in perl, java, ruby or python. The real issue is the quality of the programmer. On Fri, Jul 25, 2008 at 10:29 AM, Bill Wordsworth <[EMAIL PROTECTED]> wrote: > Obviously he is a newbie out of the woods- couldn't make a connecti

Re: [GENERAL] Data base tables design questions for: user saved forms, user parameters

2008-07-25 Thread Craig Ringer
Bruno Lavoie wrote: > We have a relatively huge number of search forms, each one with specific > fields. So I don't want, if possible, to use a distinct table for each > form. This is one of the few areas where storing XML in a relational database seems to make sense to me. Forms are well suited

Re: [GENERAL] php + postgresql

2008-07-25 Thread Bill Wordsworth
Obviously he is a newbie out of the woods- couldn't make a connection and print results something that the rest of us have been doing for years. It is newbies like him and fan-boys of Ruby/Python/Perl who give PHP a bad name. But I fail to understand the little animosity within some PostgreSQL user

Re: [GENERAL] php + postgresql

2008-07-25 Thread Joshua D. Drake
On Fri, 2008-07-25 at 17:40 +0200, Tino Wildenhain wrote: > Hi, > > > I think that PHP (like PostgreSQL, perhaps?) suffers from a reputation > > hangover from years ago. PostgreSQL was supposedly "slow", PHP is > > supposedly "undisciplined" and "unprofessional". You sure can still > > Well n

Re: [GENERAL] php + postgresql

2008-07-25 Thread Tino Wildenhain
Hi, admin wrote: Is there any special reason to use PHP? There are a couple other scripting languages useable for the web which do all have better abstration available. (afaic even PHP does have some more abstration to just using pg* functions) Well, yes, there are alternatives of course and

Re: [GENERAL] Full text index without accents

2008-07-25 Thread Jonathan Bond-Caron
Ya the function name norm_text_latin() was probably misleading, it takes latin1-ish characters *encoded in UTF8* and brings them to ascii. Definitely, the following would be much simpler: SELECT to_ascii('ÀÁÂÃÄÅÒÓÔÕÖ', 'UTF8') As of 8.3, you have to do some magic with to_ascii() and utf8 charact

Re: [GENERAL] Data base tables design questions for: user saved forms, user parameters

2008-07-25 Thread admin
I'm facing a very similar problem where I work (local govt) where we want to put around 100 forms online. The idea of 100 seperate database tables is too painful to contemplate. Depending on the nature of the data, I suppose, both the structured text string and the serialised object options so

Re: [GENERAL] Full text index without accents

2008-07-25 Thread Tom Lane
Alvaro Herrera <[EMAIL PROTECTED]> writes: > Hmm, why not simply use to_ascii() ? The big problem with to_ascii is its inadequate set of supported encodings. Somebody *really* needs to give it some love on that front. regards, tom lane -- Sent via pgsql-general mailing

Re: [GENERAL] psql \dt and identical table names across multiple schemas

2008-07-25 Thread Tom Lane
"Murat Tasan" <[EMAIL PROTECTED]> writes: > This may have been brought up before, but if not, I thought I would bring it > to attention, as I think this would be an easy fix. > The problem: 2 (or more) schemas that have an identical table name. > From within psql, the \dt (and variants of it) will

Re: [GENERAL] php + postgresql

2008-07-25 Thread admin
Is there any special reason to use PHP? There are a couple other scripting languages useable for the web which do all have better abstration available. (afaic even PHP does have some more abstration to just using pg* functions) Well, yes, there are alternatives of course and I could write this

Re: [GENERAL] Do text columns create pg_toast tables?

2008-07-25 Thread Tom Lane
Alvaro Herrera <[EMAIL PROTECTED]> writes: > In any case, since you're not using large values, the vacuum of the > toast table is essentially free. Yeah. Note the last line of the quoted log: >> Jul 25 02:31:19 iprobe001 postgres[25488]: [5-4]system usage: CPU >> 0.00s/0.00u sec elapsed

Re: [GENERAL] Help Me !!!

2008-07-25 Thread Shane Ambler
[EMAIL PROTECTED] wrote: Hello boys, I have a problem are not practical for sql. I helped to find the 'error of this query? SELECT fresh.articoli.barcode, fresh.articoli.descrizione, fresh.articoli.grammatura, fresh.articoli.id_marchio, fresh.articoli.imballo, fresh.articoli.codice

Re: [GENERAL] Full text index without accents

2008-07-25 Thread Alvaro Herrera
Jonathan Bond-Caron wrote: > This would probably help: > > CREATE OR REPLACE FUNCTION norm_text_latin(character varying) > RETURNS character varying AS > $BODY$ > declare > p_str alias for $1; > v_str varchar; > begin > select translate(p_str, 'ÀÁÂÃÄÅ', 'AA

Re: [GENERAL] PANIC: could not write to log file 0

2008-07-25 Thread Alvaro Herrera
[EMAIL PROTECTED] escribió: > Hi All - > > I am using PostgreSQL 8.1 which came packaged with WS_FTP Server 6. > The PostgreSQL service has died on me a few times over the past week > and Ipswitch support has been no help. I found the following in the > PostgreSQL log each time this happens. Mig

Re: [GENERAL] Do text columns create pg_toast tables?

2008-07-25 Thread Alvaro Herrera
Woody Woodring wrote: > The first table is what I was expecting, but I was surprised by the pg_toast > entry. I know I don't have large columns data wise in the transfer table, > but is the threat of having one ( I have one column defined as 'text') > enough for it to create the toast infrastruct

Re: [GENERAL] PANIC: could not write to log file 0

2008-07-25 Thread Craig Ringer
[EMAIL PROTECTED] wrote: 2008-07-23 23:06:16 PANIC: could not write to log file 0, segment 29 at offset 4915200, length 16384: Permission denied > 2008-07-23 23:06:16 STATEMENT: UPDATE Host_Users SET User_Failed_Login_Count = 0 WHERE (UserID = 4) This application has requested the Runtime t

[GENERAL] Data base tables design questions for: user saved forms, user parameters

2008-07-25 Thread Bruno Lavoie
Hello, I need some comments or advices regarding different tables designs approach, for two part of our needs. _*User saved forms*_ in our project, we want to give to our users ability to save form fields values for later use. It will be named the fast OR saved searches. The user can save mo

Re: [GENERAL] Substitute a variable in PL/PGSQL.

2008-07-25 Thread Roberts, Jon
> What I am trying to do is find the difference between two tables, one > that stores the > information in a single column, and the other which stores the same data > in multiple > columns. > > E.g. > CREATE TABLE test(col1 text, col2 text, col3 text, col4 text, col5 text, > col6 text, col7 text,

Re: [GENERAL] php + postgresql

2008-07-25 Thread Aarni Ruuhimäki
On Friday 25 July 2008 15:33, you wrote: > > I would avoid that in favour of using $HOME/.pgpass > > http://www.postgresql.org/docs/8.1/interactive/libpq-pgpass.html > > HTH > Tino Hi, Quite right you are. Or something like this? require("/eg/unknown_path/deep_somewhere_else/dbconnect_app_name.

[GENERAL] Do text columns create pg_toast tables?

2008-07-25 Thread Woody Woodring
I have started testing 8.3.3 and investigating how autovacuum can replace most or all of our cron maintenance tasks. While looking at autovacuum logs I see messages for vacuum come in pairs: Jul 25 02:31:19 iprobe001 postgres[25488]: [4-1] LOG: automatic vacuum of table "issp.iprobe001.probe_tra

[GENERAL] psql \dt and identical table names across multiple schemas

2008-07-25 Thread Murat Tasan
This may have been brought up before, but if not, I thought I would bring it to attention, as I think this would be an easy fix. The problem: 2 (or more) schemas that have an identical table name. >From within psql, the \dt (and variants of it) will only show a single version of that table. exampl

[GENERAL] PANIC: could not write to log file 0

2008-07-25 Thread isaiah82
Hi All - I am using PostgreSQL 8.1 which came packaged with WS_FTP Server 6. The PostgreSQL service has died on me a few times over the past week and Ipswitch support has been no help. I found the following in the PostgreSQL log each time this happens. Might anyone have some suggestions on how I

Re: [GENERAL] Full text index without accents

2008-07-25 Thread Jonathan Bond-Caron
This would probably help: CREATE OR REPLACE FUNCTION norm_text_latin(character varying) RETURNS character varying AS $BODY$ declare p_str alias for $1; v_str varchar; begin select translate(p_str, 'ÀÁÂÃÄÅ', 'AA') into v_str; select transla

Re: [GENERAL] Substitute a variable in PL/PGSQL.

2008-07-25 Thread Steve Martin
Steve Martin wrote: Hi, I am trying to create a PL/PGSQL function to return the values of the fields in a record, e.g. 1 value per row in the output of the function. How do you substitute a variable? Test case: CREATE TABLE test(col1 text, col2 text, col3 text, col4 text, col5 text, col6

[GENERAL] Sequence

2008-07-25 Thread Alexander Dobikov
Hello. A table has two primary keys: CREATE TABLE example ( pk1 integer, pk2 integer, PRIMARY KEY (pk1, pk2) ). To add a new record I use command: INSERT INTO example (pk1, pk2) VALUES (0, 0). Before adding the new record I have to find out the last value of pk2. How can I use something like t

[GENERAL] Sequence

2008-07-25 Thread Alexander Dobikov
Hello. A table has two primary keys: CREATE TABLE example ( pk1 integer, pk2 integer, PRIMARY KEY (pk1, pk2) ). To add a new record I use command: INSERT INTO example (pk1, pk2) VALUES (0, 0). Before adding the new record I have to find out the last value of pk2. How can I use something like t

Re: [GENERAL] Substitute a variable in PL/PGSQL.

2008-07-25 Thread Steve Martin
Merlin Moncure wrote: On Wed, Jul 23, 2008 at 4:08 AM, Klint Gore <[EMAIL PROTECTED]> wrote: here is a way to do it with record variables...no inner loop but doesn't the column names. with a little work you could add those with some queries to information_schema (i don't think it's worth it

Re: [GENERAL] Substitute a variable in PL/PGSQL.

2008-07-25 Thread Steve Martin
Hi Francisco, Francisco Reyes wrote: On 12:33 am 07/22/08 Steve Martin <[EMAIL PROTECTED]> wrote: Hi, I am trying to create a PL/PGSQL function to return the values of the fields in a record, e.g. 1 value per row in the output of the function. Are you trying to do a generic function

[GENERAL] Help Me !!!

2008-07-25 Thread danielimarco
Hello boys, I have a problem are not practical for sql. I helped to find the 'error of this query? SELECT fresh.articoli.barcode, fresh.articoli.descrizione, fresh.articoli.grammatura, fresh.articoli.id_marchio, fresh.articoli.imballo, fresh.articoli.codicecliente, fresh.articoli.

[GENERAL] import from ibm db2

2008-07-25 Thread Aljosa Mohorovic
i'm looking for a way to export db2 database schema/data and import it in postgres. don't know if it matters but i'm using postgres on ubuntu (version 8.3.3-0ubuntu0.8.04) for development and deployment is on db2 (obviously not my choice). sometimes i need to import data from production server so

Re: [GENERAL] php + postgresql

2008-07-25 Thread Tino Wildenhain
Aarni Ruuhimäki wrote: ... Not sure what causes this with your server but I always use something like this, ie first connect then do your stuff and then close the connection: require("dbconnect.inc"); // holds the $conn which is pg_connect("with passes") I would avoid that in favour of using

Re: [GENERAL] php + postgresql

2008-07-25 Thread Tino Wildenhain
Hi, admin wrote: Thanks again for replies. I know those questions were pretty vague. I need to set up some methodical test scripts that replicate my problems, so that it is clear what is going on. There does seem to be some evidence of problems historically with PHP and persistent connection

Re: [GENERAL] php + postgresql

2008-07-25 Thread Bill Moran
In response to Chris <[EMAIL PROTECTED]>: > > > There does seem to be some evidence of problems historically with PHP > > and persistent connections in PostgreSQL, on the PHP forums. The advice > > is typically to avoid them. > > You'll find the same advice for mysql + persistent connections or a

Re: [GENERAL] limit with subselect

2008-07-25 Thread Sam Mason
On Fri, Jul 25, 2008 at 12:02:23PM +0200, A B wrote: > and I wish to get 20 lines from T like this > > select id,a,b from T where id not in (select id from T2 where c=5) limit 20; > > but that does not seem to work. How can I get what I want? What 20 > records are selected is not important. I ju

Re: [GENERAL] limit with subselect

2008-07-25 Thread A B
Yes it obviously does! I must admit that (as usual) I found the error shortly after sending the post. The problem was that instead of select id,a,b from T where id not in (select id from T2 where c=5) I wrote select id,a,b from T where id not in (select YYY from T2 where c=5) where YYY was a n

Re: [GENERAL] limit with subselect

2008-07-25 Thread A. Kretschmer
am Fri, dem 25.07.2008, um 12:02:23 +0200 mailte A B folgendes: > Sorry if this is a double posting, I think the previous message was lost. > > I have two tables > T ( > id int primary key, > a int, > b int > ) > > T2 ( > id int references T, > c int > ); > > and I wish to get 20 lines from T

[GENERAL] limit with subselect

2008-07-25 Thread A B
Sorry if this is a double posting, I think the previous message was lost. I have two tables T ( id int primary key, a int, b int ) T2 ( id int references T, c int ); and I wish to get 20 lines from T like this select id,a,b from T where id not in (select id from T2 where c=5) limit 20; but th

[GENERAL] Subselect with limit

2008-07-25 Thread A B
I guess I can't do like this SELECT id,a,b FROM T WHERE id NOT IN (SELECT id FROM T2 WHERE c=5) LIMIT 20; I only want 20 rows. How do I do it? I have table T ( id ,a,b integer, primary key(id) ); T2 (id -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes t

Re: [GENERAL] I often have to do "update if exist, else insert", is my database design wrong?

2008-07-25 Thread Richard Huxton
A B wrote: Or is there some more general problem with the table design? table_XY is in this case (and most cases) a table like this create table table_XY ( x int references table_X, y int references table_Y ); Without knowing what XY are and what you are using table_XY for it's going

[GENERAL] I often have to do "update if exist, else insert", is my database design wrong?

2008-07-25 Thread A B
Hi. This is just some thoughts about database design. I often find my self having to do this update table_XY set x=..., y=... where x=... AND y=; if not found then insert into table_XY (x,y) values (...,...); end if; Is this normal or are there something else I could do so I don't have t

Re: [GENERAL] High activity short table and locks

2008-07-25 Thread Richard Huxton
Guillaume Bog wrote: Hello, My first impression is that vacuuming the offending table very often helps a lot. I'm doing it by hand for now but I will have a cronjob for this. By the way, it seems I don't need thoses indexes anymore. Thanks a lot for your helpful advices. Excellent! Oh, when yo

Re: [GENERAL] High activity short table and locks

2008-07-25 Thread Guillaume Bog
Hello, My first impression is that vacuuming the offending table very often helps a lot. I'm doing it by hand for now but I will have a cronjob for this. By the way, it seems I don't need thoses indexes anymore. Thanks a lot for your helpful advices. On Thu, Jul 24, 2008 at 6:19 PM, Richard Huxto

Re: [GENERAL] php + postgresql

2008-07-25 Thread admin
You need something like this: $query = "select id, name from tablename"; $result = pg_query($query); while ($row = pg_fetch_array($result)) { $content = $row[0]; } That's actually what I was using. The scoping wasn't the issue either. Today I switched back to pg_connect() from pg_pconnect(),

Re: [GENERAL] invalid byte sequence for encoding "UNICODE"

2008-07-25 Thread valgog
On Jul 24, 8:06 pm, [EMAIL PROTECTED] (AlannY) wrote: > Hi there. > > Many times, I'm confronting with that strange problem: invalid byte > sequence for encoding "UNICODE". So, I guess, Postgresql can't allow me > to use some symbols which is not a part of UNICODE. But what is that > symbals? > > I