First, you need to install the psycopg2 library if you haven't already. You can do this by running:

```bash
pip install psycopg2
```

Now you can create a Python script that connects to a PostgreSQL database and performs the required tasks.

```python
import psycopg2

# Connect to the PostgreSQL database
connection = psycopg2.connect(
    host="your_host",
    database="your_database",
    user="your_user",
    password="your_password"
)

cursor = connection.cursor()

# Create tables for users, posts, and comments
cursor.execute("""
CREATE TABLE IF NOT EXISTS users (
    id SERIAL PRIMARY KEY,
    name VARCHAR(255) NOT NULL,
    email VARCHAR(255) UNIQUE NOT NULL
);
""")

cursor.execute("""
CREATE TABLE IF NOT EXISTS posts (
    id SERIAL PRIMARY KEY,
    title TEXT NOT NULL,
    content TEXT NOT NULL,
    user_id INTEGER REFERENCES users(id)
);
""")

cursor.execute("""
CREATE TABLE IF NOT EXISTS comments (
    id SERIAL PRIMARY KEY,
    content TEXT NOT NULL,
    post_id INTEGER REFERENCES posts(id),
    user_id INTEGER REFERENCES users(id)
);
""")

# Insert sample data into the tables
cursor.execute("""
INSERT INTO users (name, email) VALUES ('John Doe', 'john@example.com');
""")
cursor.execute("""
INSERT INTO users (name, email) VALUES ('Jane Smith', 'jane@example.com');
""")
cursor.execute("""
INSERT INTO posts (title, content, user_id) VALUES ('Sample Post', 'This is a sample post.', 1);
""")
cursor.execute("""
INSERT INTO comments (content, post_id, user_id) VALUES ('Nice post!', 1, 2);
""")

connection.commit()

# Fetch all users who have commented on a specific post
post_id = 1
cursor.execute("""
SELECT users.name, users.email FROM users
JOIN comments ON users.id = comments.user_id
WHERE comments.post_id = %s;
""", (post_id,))

# Display the names and email addresses of users who have commented on the post
print("Users who have commented on post ID {}:".format(post_id))
for row in cursor.fetchall():
    print("Name: {}, Email: {}".format(row[0], row[1]))

cursor.close()
connection.close()
```

Replace `your_host`, `your_database`, `your_user`, and `your_password` with your PostgreSQL database credentials. This script creates tables for users, posts, and comments, inserts sample data into these tables, performs a query to fetch all users who have commented on a specific post, and displays their names and email addresses.
Write a Python script that connects to a PostgreSQL database, creates tables for users, posts, and comments, and inserts sample data into these tables. The script should then perform a query to fetch all users who have commented on a specific post and display their names and email addresses.
