[GENERAL] Homebrew installation question for PostgreSQL 9.4.1 (OS X 10.10.2)

2015-03-28 Thread Murthy Sandeep
Hi

I tried to install PostgreSQL 9.4.1 using homebrew on my Mac (running OS X 
10.10.2)
but I don’t it was complete.  The caveats listing included the following error

Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink include/ecpg_config.h
/usr/local/include is not writable.

You can try again using:
  brew link postgresql
== /usr/local/Cellar/postgresql/9.4.1/bin/initdb /usr/local/var/postgres
== Summary
  /usr/local/Cellar/postgresql/9.4.1: 2996 files,  40M

I tried doing

sudo brew link postgresql

but I received the following error

Error: Cowardly refusing to `sudo brew link`
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.

Any help appreciated.

SM




signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [GENERAL] pgadmin3 installation on Oracle Linux 6.6 64-bit ?

2015-03-28 Thread Tim Clarke
Yuri the 'gtk' part suggests graphics libraries to me. Since Oracle
linux is built on RedHat you can usefully use 'yum' package manager to
search that distribution's installed repositories for your file with:

sudo yum whatprovides \*libwx\*

You may want to pipe that to less since it may give a long answer. Scan
down for packages that will provide your libwx* file(s) and then install
with 'yum install (package)'.

Good luck!

Tim Clarke

On 28/03/15 01:14, Yuri Budilov wrote:
 Hello everyone.

 I am new to PostgreSQL and Linux (coming across from Microsoft SQL
 Server).

 I installed PostgreSQL 9.4 on Oracle Linux 6.6 and its working ok
 (psql, etc). 
 Now I try to install pgadmin3 on the same OS.

 I am having problems installing pdadmin3 rpms on Oracle Linux 6.6 64-bit.
 I selected the RedHat compatible installation i.e. without the Oracle
 enterprise kernel.
 It complains about missing libwx_gtk* packages when I try to do yum
 install pgadmin3*.86_64.rpm.

 The ISO file for Oracle Linux 6.6 (Packages directory of the
 distribution) does not have libwx* rpms and the gtk* rpms are already
 installed on my Oracle Linux 6.6 if I try to install them again.
 Perhaps I am looking in the wrong place??

 Is there any document or web site which clearly tells me what i need
 to pre-install so that I can install pgadmin3 on Oracle Linux 6.x 64-bit ?

 I prefer not downloading the source code and trying to build it all
 in-place, so looking for binaries ready to be installed using rpm or
 yum. I dont have Red Hat support contract, hoping to make it work on
 Oracle Linux 6.6 with RHEL kernel.

 If this is the wrong forum for this question - please tell me where to
 ask this question.

 many thanks in advance
 Yuri Budilov
 AUstralia



[GENERAL] Working with Array of Composite Type

2015-03-28 Thread Alex Magnum
Hello,
I am struggling with finding the right way to deal with arrays of composite
types. Bellow is an example of the general setup where I defined an image
type to describe the image properties. A user can have mulitple images
stored.

What is the best way to:

  a) search for an image within the array
 e.g.  WHERE image.id = 3
   WHERE is_private IS TRUE

  b) to update an image inside the array.
 e.g. is_private = FALSE WHERE image.id = 2

  c) to delete an image why its id
 e.g. WHERE image.id=2

  d) to create a listing like
 in the unset, but with the field names of the type

 e.g.
 user_id | id | caption | is_primary | is_private
-++-++-
   1 | 1  | This is Image A | f  | f
   1 | 2  | This is Image B | f  | f

CREATE TYPE image AS (
  idsmallint,
  caption   text,
  is_primaryboolean,
  is_privateboolean
);

CREATE TABLE users (
  user_id   serial NOT NULL,
  curr_countsmallint,-- just an image identifier
  imagesimage[]
);


-- create the initial user record
INSERT INTO users VALUES (default,0,null);

-- inserting new elements
UPDATE users SET curr_count=curr_count+1, images=images ||
ARRAY[row(curr_count+1,'This is Image A',false,false)::image] WHERE
user_id=1;
UPDATE users SET curr_count=curr_count+1, images=images ||
ARRAY[row(curr_count+1,'This is Image B',false,false)::image] WHERE
user_id=1;
UPDATE users SET curr_count=curr_count+1, images=images ||
ARRAY[row(curr_count+1,'This is Image C',false,true)::image]  WHERE
user_id=1;
UPDATE users SET curr_count=curr_count+1, images=images ||
ARRAY[row(curr_count+1,'This is Image D',true,false)::image]  WHERE
user_id=1;

-- list the images
SELECT user_id,curr_count,unnest(images) as limages from users WHERE
user_id=1;

SELECT user_id,curr_count,unnest(images) as limages from users WHERE
user_id=1;
 user_id | curr_count |  limages
-++---
   1 |  4 | (1,This is Image A,f,f)
   1 |  4 | (2,This is Image B,f,f)
   1 |  4 | (3,This is Image C,f,t)
   1 |  4 | (4,This is Image D,t,f)

Any help or suggestion on this topic is highly appreciated.

Thanks
Alex


Re: [GENERAL] Working with Array of Composite Type

2015-03-28 Thread Jan de Visser
On March 28, 2015 06:18:49 PM Alex Magnum wrote:
 Hello,
 I am struggling with finding the right way to deal with arrays of composite
 types. Bellow is an example of the general setup where I defined an image
 type to describe the image properties. A user can have mulitple images
 stored.

The canonical answer is that in almost all cases where you think you want an 
array of composites, you *really* want a table join:

i.e. turn your image *type* into an image *table* with the user_id as a 
foreign key.

CREATE TABLE users (
  user_id   serial NOT NULL,
);

CREATE TABLE image (
  idsmallint,
  user_id int references users (user_id)
  caption   text,
  is_primaryboolean,
  is_privateboolean
);




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