Re: [SQL] design of tables for sparse data

2007-11-12 Thread Andreas
Fernando Hevia schrieb: --- Andreas Wrote: --- ... MY QUESTIONS: Your questions have a strong "home-work" look. Yes but I didn't want to bother everyone with my project's details. It's more like a CRM. Up until now I just tried to manage somehow with the sql basics and now I like t

Re: [SQL] design of tables for sparse data

2007-11-12 Thread Fernando Hevia
> --- Andreas Wrote: --- > ... > > MY QUESTIONS: Your questions have a strong "home-work" look. > > 1) How would I SELECT a report that looks like the first version of > the pupil table out of the 3 table design? > There must be a nontrivial SELECT statement that combines all 3 tables. > E.g

[SQL] Problem with UNION-queries

2007-11-12 Thread Andreas Joseph Krogh
Hi all I have a somewhat furry solution to a problem for which I think there might be a better way to do it. The table looks like this (simplified for the sake of this example): drop table if exists test1; create table test1( id serial primary key, key varchar, username varchar, value varchar )

Re: [SQL] show value of backslashes in string array argument

2007-11-12 Thread Sabin Coanda
"Tom Lane" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > That's how it's supposed to be. See > http://www.postgresql.org/docs/8.2/static/arrays.html#AEN5876 Hi Tom, I read it and I understood there are 2 cascaded parsers, but I didn't find an explicit reference to the behavior

Re: [SQL] plpgsql language not aware of standard_conforming_strings ?

2007-11-12 Thread Sabin Coanda
"Sabin Coanda" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > "Sabin Coanda" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > ... >> >> How can I get my desired function that means when I call test( 'a\b' ) it >> will return 'a\\b' ? >> > ... > CREATE OR REPLACE

Re: [SQL] show value of backslashes in string array argument

2007-11-12 Thread Tom Lane
"Sabin Coanda" <[EMAIL PROTECTED]> writes: > I found that, is that in spite of using standard_conforming_strings = 'on', > the string array items are shown in C escape sequences conventions. That's how it's supposed to be. See http://www.postgresql.org/docs/8.2/static/arrays.html#AEN5876

Re: [SQL] plpgsql language not aware of standard_conforming_strings ?

2007-11-12 Thread Sabin Coanda
"Sabin Coanda" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] ... > > How can I get my desired function that means when I call test( 'a\b' ) it > will return 'a\\b' ? > The problem seems to be the constant evaluation in plpgsql functions which is not aware of standard_conforming_

[SQL] plpgsql language not aware of standard_conforming_strings ?

2007-11-12 Thread Sabin Coanda
Hi there, Having standard_conforming_strings = 'on', I build the following scenario. I request SELECT replace( 'a\b', '\', '\\' ), which get me the result: replace - a\\b I'd like to build a function that give me the same result, as: CREATE OR REPLACE FUNCTION "test"(s varchar) RET

Re: [SQL] show value of backslashes in string array argument

2007-11-12 Thread Achilleas Mantzios
Στις Δευτέρα 12 Νοέμβριος 2007 11:51, ο/η Sabin Coanda έγραψε: > I fond another collateral problem, because there are the different > convention to describe a varchar array item which contains backslashes, > when standard_conforming_strings = 'on' > > For instance, to get a string composed by just

Re: [SQL] show value of backslashes in string array argument

2007-11-12 Thread Sabin Coanda
I fond another collateral problem, because there are the different convention to describe a varchar array item which contains backslashes, when standard_conforming_strings = 'on' For instance, to get a string composed by just one character backslash I can use any of the two forms: SELECT A

Re: [SQL] show value of backslashes in string array argument

2007-11-12 Thread Achilleas Mantzios
If you do SELECT "colVarchar","colVarcharArray"[1] FROM test; you will see that you get identical values. -- Achilleas Mantzios ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

[SQL] show value of backslashes in string array argument

2007-11-12 Thread Sabin Coanda
Hi there, I have a problem using backslash character as part of a string array item. I use "PostgreSQL 8.2.4 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC) 3.4.2 (mingw-special)" version, with standard_conforming_strings = 'on'. I found that, is that in spite of using standard_conforming_str

Re: [SQL] Temporal databases

2007-11-12 Thread Philippe Lang
[EMAIL PROTECTED] wrote: > Hi Philippe, > Have a look at the post I made to the pgsql-sql list I made on 6th > November 2007 (day before you posted this). It contains alot of stuff > for temporal tables within Postgres. > However temporal tables (when done properly) are a very complex > subject at

Re: [SQL] Select in From clause

2007-11-12 Thread Bart Degryse
Consider this: CREATE TABLE "public"."test" ( "id" INTEGER NOT NULL, "tbl" TEXT ) WITHOUT OIDS; INSERT INTO "public"."test" ("id", "tbl") VALUES (1, 'status'); INSERT INTO "public"."test" ("id", "tbl") VALUES (2, 'yearplan'); Following two statements will return one record. select tbl from