Re: [GENERAL] Create table if not exists ... how ??

2010-07-19 Thread Said Ramirez
Assuming you know the schema name, you could always check the catalog table, something like select count(*) from pg_tables where schemaname= 'foo' and tablename='bar' If it returns, then you know a table by the name foo.bar exists. if not you can create it. -Said Jennifer Trey wrote: No

Re: [GENERAL] Multicolumn primary key with null value

2010-04-22 Thread Said Ramirez
Primary keys are defined as 'unique not null' even if they are composite. So I believe postgres would not let you do that: 5.3.4. Primary Keys Technically, a primary key constraint is simply a combination of a unique constraint and a not-null constraint. A primary key indicates that a c

Re: [GENERAL] tipo de dato

2010-03-02 Thread Said Ramirez
Miguel, Tenras mas exito si haces tus preguntas en la lista en espanol : pgsql-es-ay...@postgresql.org ya que ahi la majoria de la gente habla ingles y no espanol -Said Said Ramirez Miguel Angel Hernandez Moreno wrote: disculpen alguien tiene o sabe de algun documento que me pueda

Re: [GENERAL] How to grant a user read-only access to a database?

2010-03-02 Thread Said Ramirez
les where schemaname = 'bar' ; Note that it is important to select the schemaname because there could be two different tables in two different schemas with the same tablename. Also you should keep in mind that this will only work for tables, if you start adding views you have to add mo

Re: [GENERAL] Proxy for postgres

2009-08-14 Thread Said Ramirez
Have you tried sql relay? They support may platforms: http://sqlrelay.sourceforge.net/ -Said Martin Spinassi wrote: Hi list! I'm searching for something to use as a proxy for different instances of postgres. I've found pl/proxy, but it seems to work with (correct me if i'm wrong) functio

[GENERAL] IN limit

2008-12-10 Thread Said Ramirez
Is there a limit to the number of entries I can pass in an IN clause as part of a SELECT statement? As in SELECT baz FROM foo where id in ( 1, 2,... ) ; Thanks, -Said -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgre

Re: [GENERAL] Specifying text to substitute for NULLs in selects

2008-11-07 Thread Said Ramirez
I think you are more after something like SELECT CASE WHEN foo IS NULL THEN 'NA' END FROM bar. -Said Ivan Sergio Borgonovo wrote: On Thu, 6 Nov 2008 17:44:42 -0800 (PST) [EMAIL PROTECTED] wrote: > > Hi, > > I can specify the text used to represent a null value in output > from copy, but

Re: [GENERAL] Must be table owner to truncate?

2008-07-28 Thread Said Ramirez
According to the documentation, http://www.postgresql.org/docs/current/interactive/sql-truncate.html , only the owner can truncate a table. Which means the non-owner must either log in/ switch roles as the owner, or they can just run a DELETE. -Said smiley2211 wrote: Hello all, I am trying

Re: [GENERAL] How to remove duplicate lines but save one of the lines?

2008-07-21 Thread Said Ramirez
table); ? Is it possible to add a unique constraint to the table, with a "delete" option so it will delete duplicates? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general -- Sa

Re: [GENERAL] How to remove duplicate lines but save one of the lines?

2008-07-21 Thread Said Ramirez
There is probably a more elegant way of doing it, but a simple way of doing it ( depending on the size of the table ) could be: begin; insert into foo select distinct * from orig_table; delete from orig_table; insert into orig_table select * from foo; commit; -Said A B wrote: I have a ta

Re: [GENERAL] regexp help

2008-07-09 Thread Said Ramirez
You can probably use [^0-9] -Said Garry Saddington wrote: I have the following simple regular expression: "SELECT substring(addressline1 from '(^[0-9]+)') from addresses" How could I find non-matches of this same pattern? regards Garry -- Sent via pgsql-general mailing list (pgsql-general@po