Re: [HACKERS] multibyte-character aware support for function downcase_truncate_identifier()

2010-07-25 Thread Rajanikant Chirmade
Since discussion stopped in discussion thread

http://archives.postgresql.org/pgsql-bugs/2006-09/msg00128.php

Are there any implications of this change in handling identifiers ?

Thanks  Regards,
Rajanikant Chirmade

On Tue, Jul 13, 2010 at 12:10 AM, Rajanikant Chirmade 
rajanikant.chirm...@enterprisedb.com wrote:



 On Wed, Jul 7, 2010 at 7:37 PM, Tom Lane t...@sss.pgh.pa.us wrote:

 Rajanikant Chirmade rajanikant.chirm...@enterprisedb.com writes:
  Every identifier is downcase  truncated by function
  downcase_truncate_identifier()
  before using it.

  But since the function downcase_truncate_identifier() is not
  multibyte-charecter aware,
  it is not able to downcase some of special charecters in identifier like
  my_SchemÄ.






 IIRC this is intentional.  Please consult the archives for previous
 discussions.

regards, tom lane




 I got one discussion thread on same issue. But it stopped without any
 conclusion.

 http://archives.postgresql.org/pgsql-bugs/2006-09/msg00128.php

 Thanks  Regards,
 Rajanikant Chirmade.






Re: [HACKERS] multibyte-character aware support for function downcase_truncate_identifier()

2010-07-13 Thread Rajanikant Chirmade
On Wed, Jul 7, 2010 at 7:37 PM, Tom Lane t...@sss.pgh.pa.us wrote:

 Rajanikant Chirmade rajanikant.chirm...@enterprisedb.com writes:
  Every identifier is downcase  truncated by function
  downcase_truncate_identifier()
  before using it.

  But since the function downcase_truncate_identifier() is not
  multibyte-charecter aware,
  it is not able to downcase some of special charecters in identifier like
  my_SchemÄ.






 IIRC this is intentional.  Please consult the archives for previous
 discussions.

regards, tom lane




I got one discussion thread on same issue. But it stopped without any
conclusion.

http://archives.postgresql.org/pgsql-bugs/2006-09/msg00128.php

Thanks  Regards,
Rajanikant Chirmade.


[HACKERS] multibyte-character aware support for function downcase_truncate_identifier()

2010-07-06 Thread Rajanikant Chirmade
Hi All,

Every identifier is downcase  truncated by function
downcase_truncate_identifier()
before using it.

But since the function downcase_truncate_identifier() is not
multibyte-charecter aware,
it is not able to downcase some of special charecters in identifier like
my_SchemÄ.

If schema is created of name my_SchemÄ, pg_namespace shows entries as
my_schemÄ .

Example is as below :

postgres=# create schema my_SchemÄ;
CREATE SCHEMA
postgres=# select nspname from pg_namespace;
  nspname

 pg_toast
 pg_temp_1
 pg_toast_temp_1
 pg_catalog
 public
 information_schema
 my_schemÄ
(7 rows)

postgres=#

Achually it should downcase as my_schemä as per multibyte-character aware
as lower()
works :

postgres=# select lower('my_SchemÄ');
   lower
---
 my_schemä
(1 row)

There is function str_tolower()  which work as multibyte-character aware.
Need to use same function where ever downcase required. So, it will create
uniform down-casing at all places.

two places identified where need to add wide-character aware downcase :

1. downcase_truncate_identifier();
   -  Attaching patch for changes and small test case.

Following functions should also synchronise with
downcase_truncate_identifier() :

2. pg_strcasecmp();
3. pg_strncasecmp();

- to add fix at these functions (2,3) need to move str_tolower() from
formatting.c  from backend to some common location (may be in src/port) from
where these can be used with client as well as server.

Thanks  Regards,
Rajanikant Chirmade.
diff --git a/orig/postgresql-9.0beta2/src/backend/parser/scansup.c b/postgresql-9.0beta2/src/backend/parser/scansup.c
index 94082f7..179b37e 100644
--- a/orig/postgresql-9.0beta2/src/backend/parser/scansup.c
+++ b/postgresql-9.0beta2/src/backend/parser/scansup.c
@@ -129,33 +129,11 @@ char *
 downcase_truncate_identifier(const char *ident, int len, bool warn)
 {
 	char	   *result;
-	int			i;
-
-	result = palloc(len + 1);
-
-	/*
-	 * SQL99 specifies Unicode-aware case normalization, which we don't yet
-	 * have the infrastructure for.  Instead we use tolower() to provide a
-	 * locale-aware translation.  However, there are some locales where this
-	 * is not right either (eg, Turkish may do strange things with 'i' and
-	 * 'I').  Our current compromise is to use tolower() for characters with
-	 * the high bit set, and use an ASCII-only downcasing for 7-bit
-	 * characters.
-	 */
-	for (i = 0; i  len; i++)
-	{
-		unsigned char ch = (unsigned char) ident[i];
 
-		if (ch = 'A'  ch = 'Z')
-			ch += 'a' - 'A';
-		else if (IS_HIGHBIT_SET(ch)  isupper(ch))
-			ch = tolower(ch);
-		result[i] = (char) ch;
-	}
-	result[i] = '\0';
+	result = str_tolower(ident, len);
 
-	if (i = NAMEDATALEN)
-		truncate_identifier(result, i, warn);
+	if (len = NAMEDATALEN)
+		truncate_identifier(result, len, warn);
 
 	return result;
 }
--- This tests if identifier with special charecters using wide-charecter aware downcase.

create schema my_SchemÄ;

--- Since we smash identifiers to lower we try to find schema name
--- by downcasing nspname.
select count(nspname) from pg_namespace where nspname=LOWER('my_SchemÄ');

drop schema my_SchemÄ;



wide-charecter_aware_downcase.out
Description: Binary data

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] how to use eclipse when debugging postgreSQL backend

2009-09-30 Thread Rajanikant Chirmade
Hello Hongchan,

You need go to through following steps :


   1. Debug Perspective = Run = Debug Configuration
   2. On left side of menu you can see C/C++ Attach to Application
   3. Right click on C/C++ Attach to Application and create new debug
   configuration,
   4. Set Project,  Build Configuration as Use Active , C/C++ Application
   as postgres executable path,
   5. Start postmaster  one instant of postgresql client (for creating one
   new postgres),
   6. Click on Debug which will show current process list,
   7. Select forked postgres process you want to debug
   8. Put breakpoint in your function,

this is working for me.

Hopefully this helps you.

Thanks  Regards,
Rajanikant Chirmade.




2009/9/28 노홍찬 falls...@cs.yonsei.ac.kr

  Hello hackers,





 I really appreciate Mr. Cecchet’s effort to establish the wiki page
 (working_with_eclipse,
 http://archives.postgresql.org/pgsql-hackers/2008-10/msg00312.php).



 I set up my PostgreSQL development environment with Eclipse, following the
 page’s instructions.



 However, I’m stuck to thesituation that I cannot debug the modified backend
 source of PostgreSQL



 since the gdb incorporated with Eclipse doesn’t support the debugging of
 the forked child processes.





 When I start debugging process by using the project default, it can only
 debug the postmaster process,



 since the postmaster process forks child processes each of which is
 actually postgres backend process responsible for the response to each
 client process (psql).



 What I’m trying to debug is the storage-related part of the backend source,
 so the gdb should be able to access the forked processes.



 I tried several ways like making the default option of gdb to be ‘set
 follow-fork-mode child’, but those tries didn’t work.



 For sure, there is another option, giving up using eclipse when debugging
 and using the console-mode gdb,



 but I prefer using graphical development environment and that’s the reason
 why I chose to use eclipse as a default development tool in the very first
 start.



 (This try might be regarded as silly though, I might be supposed to get
 familiar to console development environment,



 but if someone went through the same situation before and he or she can
 help me, it will be very time-saving)





 If someone can let me know how to set Eclipse or several steps needed to
 access the forked process while Elipse debugging,



 It will be very much helpful to me.



 Thank you for reading this





 *- Best Regards
   Hongchan
   (falls...@cs.yonsei.ac.kr, (02)2123-7757) -*