Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Dev Kumkar
On Thu, Jul 4, 2013 at 1:17 AM, Tom Lane wrote: > Quite aside from implementation difficulty, restricting the change to > just column aliases doesn't make it more palatable. You'd entirely lose > the argument that the change increases spec compliance, because the spec > is perfectly clear that a

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Dev Kumkar
On Thu, Jul 4, 2013 at 1:36 AM, Bruce Momjian wrote: > And let's not forget that column aliases can be used as indentifiers in > queries: > > test=> SELECT 1 AS x > test-> ORDER BY x; > x > --- > 1 > (1 row) > > test=> SELECT 1 AS "X" >

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Dev Kumkar
On Thu, Jul 4, 2013 at 12:38 AM, Alvaro Herrera wrote: > Aliases are treated just like any other identifier. The downcasing > happens in the lexer (src/backend/parser/scan.l), which is totally > unaware of the context in which this is happening; so there's no way to > tweak the downcasing behavio

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Dev Kumkar
On Wed, Jul 3, 2013 at 9:50 PM, Tom Lane wrote: > > Any plans to fix this in next release or having a patch to fix this? > > No. > > This has been discussed (many times) before. There isn't any feasible > way to change this behavior without breaking an incredible amount of > code, much of which

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Dev Kumkar
On Wed, Jul 3, 2013 at 9:35 PM, Thomas Kellerer wrote: > I wonder why you need that. I never had the requirement for that. > > Which driver/interface do you use that requires an alias to be all > uppercase? Looks like you didn't get me, am not saying aliases to be all upper case by default (BTW

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Dev Kumkar
On Wed, Jul 3, 2013 at 9:05 PM, Bruce Momjian wrote: > Yes, both the identifier names and alias names are folded to lower case. > I never thought of them as different, but you are right, they are, and > we are non-standard in both areas. Sorry. Any plans to fix this in next release or having a

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Dev Kumkar
On Wed, Jul 3, 2013 at 8:54 PM, Bruce Momjian wrote: > Agreed. The original poster specifically wanted "MYTABLE" and mytable > to be the same, not "mytable" and mytable. Postgres is certainly > non-standard in this area. I think the ability visiually distinguish > lower-case letters better tha

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Dev Kumkar
Thanks! Sure this is not a bug. Just want to know if there is any possible way to achieve this. Reason being - need to change all the data layer of project where the column mapping has been done with Upper Case. Regards...

[SQL] Re: Unquoted column names fold to lower case

2013-07-03 Thread Dev Kumkar
Resending On Wed, Jul 3, 2013 at 2:42 PM, Dev Kumkar wrote: > Hello, > > All unquoted identifiers are assumed by PostgreSQL to be lower case by > default. This means > - SELECT MY_COLUMN FROM my_table > - SELECT my_column FROM my_table > - SELECT my_column as MY_COLUMN FROM

[SQL] Unquoted column names fold to lower case

2013-07-03 Thread Dev Kumkar
Hello, All unquoted identifiers are assumed by PostgreSQL to be lower case by default. This means - SELECT MY_COLUMN FROM my_table - SELECT my_column FROM my_table - SELECT my_column as MY_COLUMN FROM my_table All refer to my_column and has column name in lowercase as my_column. If the aliases ar

[SQL] Facing authentication error on postgres 9.2 -> dblink functions

2013-02-06 Thread Dev Kumkar
Hello Everyone, I am using postgres 9.2 and when executing function dblink facing a fatal error while trying to execute dblink_connect as follows: * SELECT * FROM dblink_connect('host=127.0.0.1 port=5432 dbname=postgres password=test')* *ERROR*: could not establish connection DETAIL: FATA

Re: [SQL] Querying multiple database

2013-02-06 Thread Dev Kumkar
Hello Again, Using dblink and now am facing a fatal error while tryinf to execute dblink_connect as follows: SELECT * FROM dblink_connect('host=127.0.0.1 port=5432 dbname=postgres password=test') ERROR: could not establish connection DETAIL: FATAL: password authentication failed for user "NET

Re: [SQL] Querying multiple database

2013-02-05 Thread Dev Kumkar
Am looking for pointers related to cross-database queries? Thanks in advance! On Tue, Feb 5, 2013 at 10:42 PM, Dev Kumkar wrote: > Hello everyone, > > Please can you point me to the contrib/dblink package links. > > What am actually looking for is query multiple database located

[SQL] Querying multiple database

2013-02-05 Thread Dev Kumkar
. Regards - Dev

Re: [SQL] update from select

2007-10-29 Thread dev
Yes, both have varchar(50). Query: UPDATE owner SET picturemedium = dvds.picturemedium, title = dvds.title, titleOrder = dvds.title, releasedate = CAST(dvds.releasedate AS date) FROM ( SELECT DISTINCT detail_dvd.asin, detail_dvd.picturemedium, detail_dvd.title,

[SQL] update from select

2007-10-29 Thread dev
Hello I have a performance problem with an SQL statement. Is there a better way to do this update: UPDATE table1 SET column2 = temp_table.column2, column3 = temp_table.column3, column4 = CAST(temp_table.column4 AS date) FROM ( SELECT DISTINCT table2.column1, table2.column2, table2

Re: [SQL] Change of data type

2006-08-10 Thread Kumar Dev
Use Alter table notebook from control center right click on the table and open alter table notebook you can drop a column or add a column or change the datatype   Kumar  On 8/7/06, Judith <[EMAIL PROTECTED]> wrote:    Hello everybody, excuse me how can I change de data type of a field,I currently h

Re: [SQL] upcasting multiplication in a query

2003-03-17 Thread dev
> i have a schema that stores timestamps in seconds/microseconds format. > each > column in the table is int4. what i want to do is to compute the int8 > value > of total microseconds, a la: > select (seconds*100)+micros from my_table; > but it looks to me like postgresql puts the rresult int

Re: [SQL] Poor performance on a right join

2003-03-17 Thread dev
> Here's the EXPLAIN output: > > EXPLAIN ANALYZE SELECT a.CALL_DATE, a.OPERATOR_ID, a.CUST_CODE FROM > PHONE as b right join CALLHIST as a on (a.CUST_CODE=b.CUST_CODE) where > (b.PHONE > = '847-478-2100') order by a.call_date desc; > NOTICE: QUERY PLAN: > > Sort (cost=14320.04..14320.04 rows=6046

Re: [SQL] Poor performance on a right join

2003-03-14 Thread dev
> When doing a join query I am getting a responce time of 3 seconds. The > callhist table has 66000 rows and the phone table has 1 rows. I > have an indexes on callhist.call_date, callhist.operator_id, > phone.phone, & phone.cust_code. Here's the SQL > SELECT a.CALL_DATE, a.OPERATOR_ID, a.CUST_

Re: [SQL] which will be faster? w/ or w/o indices

2003-02-07 Thread dev
> I understand that if you are importing data into the database > that this will go faster if there are no indices against the > target table. > > If I want to run this statement: > INSERT INTO table_a SELECT * from table_b WHERE value_1 BETWEEN > X AND Y; > is it best to do that with or without in

[SQL] RCF: 2nd draft: A brief guide to Nulls

2003-01-17 Thread dev
Thanks all for the previous feedback. If no-one comes up with any errors in this draft I'll call it finished. - Richard Huxton A Brief Guide to NULLs == revision: 0.9 date: 2002-01-17 author: Richard Huxton <[EMAIL PROTECTED]> Overview This is a short guide to

Re: [SQL] RFC: A brief guide to nulls

2003-01-16 Thread dev
Apologies for previous post with no content - hit send by mistake. Thanks to everyone for the feedback, 2nd draft out later today/tomorrow. - Richard Huxton ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql

Re: [SQL] RFC: A brief guide to nulls

2003-01-16 Thread dev
> > --- [EMAIL PROTECTED] wrote: >> There have been a few posts recently where people >> have had problems with >> nulls. Anyone got comments on the below before I >> submit it to techdocs? >> >> TIA >> >> - Richard Huxton >> >> A Brief Guide to NULLs >> == >> >> What is a null?

[SQL] RFC: A brief guide to nulls

2003-01-15 Thread dev
There have been a few posts recently where people have had problems with nulls. Anyone got comments on the below before I submit it to techdocs? TIA - Richard Huxton A Brief Guide to NULLs == What is a null? === A null is *not* an empty string. A null is *not* a

Re: [SQL] Crosstab-style query in pure SQL

2003-01-13 Thread dev
> Richard, > >> I have a table containing milestones achieved for projects, marked as >> being in particular quarters. >> >> CREATE TABLE milestones ( >> proj_id int4, >> sortorder SERIAL, >> qtr int4, >> description varchar(200) >> ); >> >> Now I need the milestone de

[SQL] Crosstab-style query in pure SQL

2003-01-13 Thread dev
TIA all I have a table containing milestones achieved for projects, marked as being in particular quarters. CREATE TABLE milestones ( proj_id int4, sortorder SERIAL, qtr int4, description varchar(200) ); Now I need the milestone descriptions output across the page l

Re: [SQL] Unique indexes not unique?

2003-01-13 Thread dev
> Jimmy Mäkelä wrote: > >> I found that Postgres isn't behaving like I thought when using a >> unique index in >> combination with NULL-values... >> Is this a bug or specified in the SQL-standard? If its a bug, is it >> fixed in a >> recent version? We are using 7.2.3 >> intranet=# insert into "fo

Re: [SQL] Table Design Questions

2003-01-10 Thread dev
> Hello, > > I am trying to come up with an efficient table design > that describes a fantasy character that meets the > following criteria: Apologies for only dealing with the last part of your query - busy at the moment. I'll try and follow up in more detail later. > CREATE TABLE ATTRIBUTES (

Re: [SQL] insert rule doesn't see id field

2003-01-09 Thread dev
> On Wed, Jan 08, 2003 at 01:13:03PM -0500, Ron Peterson wrote: >> On Tue, Jan 07, 2003 at 11:01:08AM -0500, Tom Lane wrote: >> >> > > I thought that the idea behind noup was to protect single columns >> from >> > > update. However, when I apply the noup trigger as above, I can't >> > > update /an

Re: [SQL] order by and aggregate

2003-01-06 Thread dev
> Richard Huxton wrote: > >> On Monday 06 Jan 2003 12:44 pm, Tomasz Myrta wrote: >> >> >Hi >> >I created my own aggregate function working as max(sum(value)) >> >It adds positive and negative values and finds maximum of this sum. >> >To work properly this function needs data to be sorted. >> >> >>

Re: [SQL] Are sub-select error suppressed?

2002-11-26 Thread dev
> On Tue, 26 Nov 2002, Richard Huxton wrote: > >> On Tuesday 26 Nov 2002 9:43 am, patrick wrote: >> > Greetings, >> > >> > I'm not sure what the correct behavior is here but the observed >> > behavior seems "wrong" (or at least undesirable). >> Don't look right to me, and I still see it here in 7.

Re: [SQL] enforcing with unique indexes..

2002-10-05 Thread dev
> > ie i want 1 to 1 mapping between group_id and userid so that , there > shud not be a single group_id having more that one kind of userid. > > can it be done with some sort of UNIQUE INDEX? If you want multiple groups but the user should always be the same 1 1 ok 1 1 ok 2 1 ok 3 2 ok

Re: [SQL] Date Validation?

2001-07-14 Thread dev
> Richard, > >> Out of curiosity Josh, why aren't you validating in PHP? - only takes >> a >> couple of lines there. > > We are. It's just that all other validation takes place inside the > PL/pgSQL functions in order to keep all the business logic in the > database. Having one form of validat

Re: [SQL] Writing SQL functions in Postgres

2001-03-08 Thread dev
Boulat Khakimov <[EMAIL PROTECTED]> said: > I want to write an SQL function in postgres that returns > row as a result. > > The problem is the select statement inside the funtion has > a two table join. So I dont know what to put after SETOF > > CREATE FUNCTION dummy() > RETURNS SETOF ? >

Re: [SQL] Newbie: execute function error!

2001-03-07 Thread dev
On 3/6/01, 5:55:05 AM, John GM <[EMAIL PROTECTED]> wrote regarding [SQL] Newbie: execute function error!: > I created a sample function: > CREATE FUNCTION concat_text (text, text) RETURNS text AS ' > BEGIN > RETURN $1 || $2; > END; ' > LANGUAGE 'plpgsql'; > The creation was fine. But whe

Re: [SQL] work on rows

2001-03-07 Thread dev
Author: Rachel Coin <[EMAIL PROTECTED]> I have a problem with a sql query.I have two tables : the first contains categories and the second subcategories. What kind of select may I use to get something like Yahoo! categories ( each "main" category gets *at most* three sub-categories.. Do yo

Re: [SQL] Quick question MySQL --> PgSQL

2001-03-06 Thread dev
On 3/6/01, 5:26:18 PM, Josh Berkus <[EMAIL PROTECTED]> wrote regarding [SQL] Quick question MySQL --> PgSQL: > Folks, > Just a quick question ... I need to do a regular transfer (daily + on > demand) of data from a MySQL database to a PostgreSQL database and back > again. Can anybody st

Re: [SQL] Problems with RULE

2001-03-06 Thread dev
On 3/6/01, 7:11:48 AM, Jens Hartwig <[EMAIL PROTECTED]> wrote regarding [SQL] Problems with RULE: > Hello all, > I tried to implement the following rule: if someone wants to delete a record > from a table t_xyz (id integer, deleted boolean) the record should get a > delete-flag (deleted = true

Re: [SQL] Permissons on database

2001-03-06 Thread dev
On 3/6/01, 5:00:47 PM, Boulat Khakimov <[EMAIL PROTECTED]> wrote regarding [SQL] Permissons on database: > Hi, > How do I grant permissions on everything in the selected databes? > GRANT doesnt take as on object database name nor does it accept wild > chars By hand at the moment I'm afrai

Re: [SQL] Problems with RULE

2001-03-06 Thread dev
On 3/6/01, 7:11:48 AM, Jens Hartwig <[EMAIL PROTECTED]> wrote regarding [SQL] Problems with RULE: > Hello all, > I tried to implement the following rule: if someone wants to delete a record > from a table t_xyz (id integer, deleted boolean) the record should get a > delete-flag (deleted = true

Re: [SQL] Comparing dates

2001-03-06 Thread dev
On 3/6/01, 4:38:41 PM, <[EMAIL PROTECTED]> wrote regarding Re: [SQL] Comparing dates: > Markus Fischer wrote: > > I've a SELECT statement on many joined Tabled and one of them has > > a date column called 'date_date'. When I fetch a date e.g. > > '02-03-2001', I get, say, 60 results back. When I

Re: [SQL] C/C++ interface

2001-02-16 Thread dev
>> Original Message << On 2/16/01, 8:24:09 AM, Volker Paul <[EMAIL PROTECTED]> wrote regarding Re: [SQL] C/C++ interface: > Tom Lane wrote: > > > > Volker Paul <[EMAIL PROTECTED]> writes: > > > Is someone maintaining the C++ interface and its documentation? >