Re: [SQL] Creating a new database with a TEMPLATE did not work
Quoth adrian.kla...@gmail.com (Adrian Klaver): > On 02/25/2013 02:49 PM, mkumbale wrote: > > Hi, I am new to PostgreSQL. I have an empty PostgreSQL DB containing tables > > but no data. I issued the following command in PGADMIN SQL editor: > > > > CREATE DATABASE "NewDefault" > >WITH OWNER = postgres > > ENCODING = 'UTF8' > > TEMPLATE = Default > > TABLESPACE = pg_default > > LC_COLLATE = 'English_United States.1252' > > LC_CTYPE = 'English_United States.1252' > > CONNECTION LIMIT = -1; > > > > Although it created the NewDefault DB, it does not contain any of the tables > > in Default. Default was disconnected when I executed this command. > > > > What am I doing something wrong? > > So you have a database named Default? > > Probably not a good name because: > http://www.postgresql.org/docs/9.2/interactive/sql-createdatabase.html > > template > The name of the template from which to create the new database, or > DEFAULT to use the default template (template1). > > So at a guess you are actually creating the new database from template1. Also, SQL names are folded to lowercase unless they are quoted, so TEMPLATE = Default would refer to a database called "default" (if it weren't special syntax for template1), but TEMPLATE = "Default" should find a database created with CREATE DATABASE "Default". Ben -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
Re: [SQL] Creating a new database with a TEMPLATE did not work
On 02/25/2013 02:49 PM, mkumbale wrote: Hi, I am new to PostgreSQL. I have an empty PostgreSQL DB containing tables but no data. I issued the following command in PGADMIN SQL editor: CREATE DATABASE "NewDefault" WITH OWNER = postgres ENCODING = 'UTF8' TEMPLATE = Default TABLESPACE = pg_default LC_COLLATE = 'English_United States.1252' LC_CTYPE = 'English_United States.1252' CONNECTION LIMIT = -1; Although it created the NewDefault DB, it does not contain any of the tables in Default. Default was disconnected when I executed this command. What am I doing something wrong? So you have a database named Default? Probably not a good name because: http://www.postgresql.org/docs/9.2/interactive/sql-createdatabase.html template The name of the template from which to create the new database, or DEFAULT to use the default template (template1). So at a guess you are actually creating the new database from template1. Thanks, Murali -- View this message in context: http://postgresql.1045698.n5.nabble.com/Creating-a-new-database-with-a-TEMPLATE-did-not-work-tp5746627.html Sent from the PostgreSQL - sql mailing list archive at Nabble.com. -- Adrian Klaver adrian.kla...@gmail.com -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
[SQL] Creating a new database with a TEMPLATE did not work
Hi, I am new to PostgreSQL. I have an empty PostgreSQL DB containing tables but no data. I issued the following command in PGADMIN SQL editor: CREATE DATABASE "NewDefault" WITH OWNER = postgres ENCODING = 'UTF8' TEMPLATE = Default TABLESPACE = pg_default LC_COLLATE = 'English_United States.1252' LC_CTYPE = 'English_United States.1252' CONNECTION LIMIT = -1; Although it created the NewDefault DB, it does not contain any of the tables in Default. Default was disconnected when I executed this command. What am I doing something wrong? Thanks, Murali -- View this message in context: http://postgresql.1045698.n5.nabble.com/Creating-a-new-database-with-a-TEMPLATE-did-not-work-tp5746627.html Sent from the PostgreSQL - sql mailing list archive at Nabble.com. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
[SQL] Euclidean distance between two sets of tuples
Hi all, I would like to ask if there exists a function to calculate the Euclidean distance between two rows of the same table. Obviously, the distance between two non-numeric fields should be 0 if they are the same value, 1 otherwise. In general, I need to compute an average distance between the subsets of rows, computed pairwise. Example: - Set 1: 10 rows - Set 2: 15 rows - Distances computed 150 I just need the value 1/150*(Sum of all the computed Euclidean distances). I could write a procedure, but it would be nice if there already exists a function which at least computes a single Euclidean function between two rows. Any suggestion? Thank you. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql