Since you haven't shown the data, table defs, explained the problem, etc, I can't really show a specific query. The general idea is to use the subquery in FROM with an alias, like:

CREATE TABLE test_buffslip AS
SELECT
   ST_INTERSECTS(...)
FROM (
  SELECT ST_Buffer(geom, 0.005) 
  FROM segments where class = 7
) seg_buffers;


postgres: how to use subquery correctly?
I have recessed lighting in my living room.  One of the bulbs went out.  I tried replacing it with a fresh one, but no luck.  There is electricity flowing to the socket, but the socket appears to have gone bad.

I bought a replacement socket at Home Depot, but upon disassembling the light, I realized that I might not be able to replace the socket alone.

I have a Lightolier Lytecaster 1102 Frame-In-Kit.  Details here:

http://www.lightolier.com/MKACatpdfs/1102D1.PDF

http://www.lightolier.com/MKACatinstr/IS_1102.PDF

It doesn't look like the socket can be removed from the porcelain socket housing.  Does this mean I have to replace the entire framing kit?  I tried calling Lightolier support, but so far I've only gotten an answering machine.

Here are photos of the enclosure:



And how the socket is fastened: 



SOLVED: See Dan's answer below. I don't know how I missed it, but inside the socket there are screws.  The socket is not riveted to the enclosure.  Alas, I did have to buy the whole Frame-in-Kit to get the correct socket, but at least I didn't have to remove the entire frame from the ceiling.  I just unscrewed the socket and screwed in the new one.
